Fix loop head split for infinite loops
This commit is contained in:
parent
35a0b36a0d
commit
100608e0ac
|
@ -114,7 +114,7 @@ bool IntegerValueRange::Weaker(const IntegerValueRange& range) const
|
||||||
}
|
}
|
||||||
else if (mMinState == S_WEAK)
|
else if (mMinState == S_WEAK)
|
||||||
{
|
{
|
||||||
if (range.mMinState == S_BOUND)
|
if (range.mMinState == S_BOUND || range.mMinState == S_UNBOUND)
|
||||||
minWeak = true;
|
minWeak = true;
|
||||||
if (range.mMinState == S_WEAK && mMinValue != range.mMinValue)
|
if (range.mMinState == S_WEAK && mMinValue != range.mMinValue)
|
||||||
minWeak = true;
|
minWeak = true;
|
||||||
|
@ -138,7 +138,7 @@ bool IntegerValueRange::Weaker(const IntegerValueRange& range) const
|
||||||
}
|
}
|
||||||
else if (mMaxState == S_WEAK)
|
else if (mMaxState == S_WEAK)
|
||||||
{
|
{
|
||||||
if (range.mMaxState == S_BOUND)
|
if (range.mMaxState == S_BOUND || range.mMaxState == S_UNBOUND)
|
||||||
maxWeak = true;
|
maxWeak = true;
|
||||||
if (range.mMaxState == S_WEAK && mMaxValue != range.mMaxValue)
|
if (range.mMaxState == S_WEAK && mMaxValue != range.mMaxValue)
|
||||||
maxWeak = true;
|
maxWeak = true;
|
||||||
|
@ -6294,7 +6294,9 @@ bool InterCodeBasicBlock::StripLoopHead(void)
|
||||||
ExpandingArray<InterCodeBasicBlock*> lblocks;
|
ExpandingArray<InterCodeBasicBlock*> lblocks;
|
||||||
if (CollectSingleEntryGenericLoop(lblocks))
|
if (CollectSingleEntryGenericLoop(lblocks))
|
||||||
{
|
{
|
||||||
// printf("StripB %s %d\n", mProc->mIdent->mString, mIndex);
|
if (!lblocks.Contains(mTrueJump) || !lblocks.Contains(mFalseJump))
|
||||||
|
{
|
||||||
|
// printf("StripB %s %d\n", mProc->mIdent->mString, mIndex);
|
||||||
|
|
||||||
mLoopPrefix->mInstructions.SetSize(0);
|
mLoopPrefix->mInstructions.SetSize(0);
|
||||||
for (int i = 0; i < mInstructions.Size(); i++)
|
for (int i = 0; i < mInstructions.Size(); i++)
|
||||||
|
@ -6324,6 +6326,7 @@ bool InterCodeBasicBlock::StripLoopHead(void)
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mVisited = true;
|
mVisited = true;
|
||||||
|
|
||||||
|
@ -21528,6 +21531,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
||||||
mInstructions[i + 1]->mSrc[0].mIntConst + mInstructions[i + 0]->mSrc[0].mIntConst < 256)
|
mInstructions[i + 1]->mSrc[0].mIntConst + mInstructions[i + 0]->mSrc[0].mIntConst < 256)
|
||||||
{
|
{
|
||||||
mInstructions[i + 1]->mSrc[0].mTemp = mInstructions[i + 0]->mSrc[1].mTemp;
|
mInstructions[i + 1]->mSrc[0].mTemp = mInstructions[i + 0]->mSrc[1].mTemp;
|
||||||
|
mInstructions[i + 1]->mSrc[0].mRange = mInstructions[i + 0]->mSrc[1].mRange;
|
||||||
mInstructions[i + 1]->mSrc[0].mIntConst += mInstructions[i + 0]->mSrc[0].mIntConst;
|
mInstructions[i + 1]->mSrc[0].mIntConst += mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||||
mInstructions[i + 1]->mSrc[0].mFinal = mInstructions[i + 0]->mSrc[1].mFinal;
|
mInstructions[i + 1]->mSrc[0].mFinal = mInstructions[i + 0]->mSrc[1].mFinal;
|
||||||
mInstructions[i + 0]->mCode = IC_NONE;
|
mInstructions[i + 0]->mCode = IC_NONE;
|
||||||
|
|
|
@ -64,6 +64,7 @@ const char * scrolltext[] = {
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +199,7 @@ int main(void)
|
||||||
// Update interrupt position
|
// Update interrupt position
|
||||||
for(char i=0; i<5; i++)
|
for(char i=0; i<5; i++)
|
||||||
{
|
{
|
||||||
int ty = 48 * i + 46 + oy;
|
int ty = 48 * i + 45 + oy;
|
||||||
|
|
||||||
// No interrupts below screen bottom
|
// No interrupts below screen bottom
|
||||||
if (ty < 250)
|
if (ty < 250)
|
||||||
|
@ -246,7 +247,7 @@ int main(void)
|
||||||
case 42:
|
case 42:
|
||||||
readline(line, lpos);
|
readline(line, lpos);
|
||||||
lpos++;
|
lpos++;
|
||||||
if (lpos == 28)
|
if (lpos == 27)
|
||||||
lpos = 0;
|
lpos = 0;
|
||||||
break;
|
break;
|
||||||
case 45:
|
case 45:
|
||||||
|
|
Loading…
Reference in New Issue