Fix range correction for post dec loop counters
This commit is contained in:
parent
925ee9d8f3
commit
44a9aaf89b
|
@ -17748,15 +17748,18 @@ bool InterCodeBasicBlock::PostDecLoopOptimization(void)
|
||||||
|
|
||||||
int64 v = ins->mSrc[inco].mIntConst;
|
int64 v = ins->mSrc[inco].mIntConst;
|
||||||
|
|
||||||
if (ins->mDst.mRange.mMaxState == IntegerValueRange::S_BOUND)
|
ins->mDst.mRange.AddConstValue(ins->mDst.mType, -v);
|
||||||
ins->mDst.mRange.mMaxValue -= v;
|
ins->mSrc[1 - inco].mRange.AddConstValue(ins->mDst.mType, -v);
|
||||||
if (ins->mSrc[1 - inco].mRange.mMinState == IntegerValueRange::S_BOUND)
|
mEntryValueRange[ltemp].AddConstValue(ins->mDst.mType, -v);
|
||||||
ins->mSrc[1 - inco].mRange.mMinValue -= v;
|
|
||||||
|
|
||||||
mInstructions.Remove(inci);
|
mInstructions.Remove(inci);
|
||||||
mInstructions.Insert(movi, ins);
|
mInstructions.Insert(movi, ins);
|
||||||
InterInstruction* pins = ins->Clone();
|
InterInstruction* pins = ins->Clone();
|
||||||
pins->mSrc[inco].mIntConst = -v;
|
pins->mSrc[inco].mIntConst = -v;
|
||||||
|
|
||||||
|
pins->mDst.mRange.AddConstValue(ins->mDst.mType, -v);
|
||||||
|
ins->mSrc[1 - inco].mRange.AddConstValue(ins->mDst.mType, -v);
|
||||||
|
|
||||||
pblock->mInstructions.Insert(pblock->mInstructions.Size() - 1, pins);
|
pblock->mInstructions.Insert(pblock->mInstructions.Size() - 1, pins);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
@ -22241,7 +22244,7 @@ void InterCodeProcedure::Close(void)
|
||||||
{
|
{
|
||||||
GrowingTypeArray tstack(IT_NONE);
|
GrowingTypeArray tstack(IT_NONE);
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "main");
|
CheckFunc = !strcmp(mIdent->mString, "foo");
|
||||||
CheckCase = false;
|
CheckCase = false;
|
||||||
|
|
||||||
mEntryBlock = mBlocks[0];
|
mEntryBlock = mBlocks[0];
|
||||||
|
|
Loading…
Reference in New Issue