Fix loss of zero page dependency in tail code merge

This commit is contained in:
drmortalwombat 2023-12-17 12:40:09 +01:00
parent ae4b48c445
commit 4a8010a3a0
2 changed files with 8 additions and 5 deletions

View File

@ -16789,6 +16789,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
mInstructions[i + 2]->mSrc[0].mType == IT_INT8)
{
mInstructions[i + 1]->mSrc[1] = mInstructions[i + 0]->mSrc[0];
mInstructions[i + 0]->mSrc[0].mFinal = false;
mInstructions[i + 1]->mDst.mType = IT_INT8;
changed = true;
@ -16807,6 +16808,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
mInstructions[i + 2]->mSrc[0].mType == IT_INT8)
{
mInstructions[i + 1]->mSrc[0] = mInstructions[i + 0]->mSrc[0];
mInstructions[i + 0]->mSrc[0].mFinal = false;
mInstructions[i + 1]->mDst.mType = IT_INT8;
changed = true;
@ -19139,7 +19141,7 @@ void InterCodeProcedure::Close(void)
{
GrowingTypeArray tstack(IT_NONE);
CheckFunc = !strcmp(mIdent->mString, "main");
CheckFunc = !strcmp(mIdent->mString, "interpret_statement");
CheckCase = false;
mEntryBlock = mBlocks[0];
@ -20303,7 +20305,7 @@ bool InterCodeBasicBlock::SameExitCode(const InterCodeBasicBlock* block) const
{
if (mInstructions[j0]->mCode == IC_LEA && mInstructions[j0]->mSrc[1].mTemp < 0)
return false;
if (block->mInstructions[j1]->mCode == IC_LEA && mInstructions[j1]->mSrc[1].mTemp < 0)
if (block->mInstructions[j1]->mCode == IC_LEA && block->mInstructions[j1]->mSrc[1].mTemp < 0)
return false;
}
}

View File

@ -21816,8 +21816,8 @@ bool NativeCodeBasicBlock::JoinTailCodeSequences(NativeCodeProcedure* proc, bool
{
if (!mTrueJump->mIns[0].ChangesCarry() && mTrueJump->mIns[0].IsSame(mFalseJump->mIns[0]))
{
int live = mTrueJump->mIns[0].mLive;
mTrueJump->mIns[0].mLive |= LIVE_CPU_REG_C;
int live = mTrueJump->mIns[0].mLive | mFalseJump->mIns[0].mLive;
mTrueJump->mIns[0].mLive |= LIVE_CPU_REG_C | live;
mIns.Push(mTrueJump->mIns[0]);
mTrueJump->mIns.Remove(0);
mFalseJump->mIns.Remove(0);
@ -44723,7 +44723,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
{
mInterProc = proc;
CheckFunc = !strcmp(mInterProc->mIdent->mString, "mh_size");
CheckFunc = !strcmp(mInterProc->mIdent->mString, "interpret_builtin");
int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks];
@ -45664,6 +45664,7 @@ void NativeCodeProcedure::Optimize(void)
changed = true;
}
if (step > 2 && !changed)
{
ResetVisited();