Fix index register conflict when removing condition check after load

This commit is contained in:
drmortalwombat 2024-05-21 22:03:51 +02:00
parent 2c28551ca3
commit ccf13c78f0

View File

@ -44599,7 +44599,8 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
} }
else if ( else if (
mIns[i + 0].ChangesAccuAndFlag() && mIns[i + 0].ChangesAccuAndFlag() &&
(mIns[i + 1].mType == ASMIT_LDY || mIns[i + 1].mType == ASMIT_LDX) && (mIns[i + 1].mType == ASMIT_LDY && !mIns[i + 0].RequiresYReg() ||
mIns[i + 1].mType == ASMIT_LDX && !mIns[i + 0].RequiresXReg()) &&
mIns[i + 2].mType == ASMIT_STA && mIns[i + 2].mType == ASMIT_STA &&
mIns[i + 3].mType == ASMIT_ORA && mIns[i + 3].mMode == ASMIM_IMMEDIATE && mIns[i + 3].mAddress == 0) mIns[i + 3].mType == ASMIT_ORA && mIns[i + 3].mMode == ASMIM_IMMEDIATE && mIns[i + 3].mAddress == 0)
{ {
@ -48061,7 +48062,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
{ {
mInterProc = proc; mInterProc = proc;
CheckFunc = !strcmp(mInterProc->mIdent->mString, "enemies_move"); CheckFunc = !strcmp(mInterProc->mIdent->mString, "Actor::setupFrame");
int nblocks = proc->mBlocks.Size(); int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks]; tblocks = new NativeCodeBasicBlock * [nblocks];
@ -48872,6 +48873,7 @@ void NativeCodeProcedure::Optimize(void)
#endif #endif
if (step == 2) if (step == 2)
{ {
ResetVisited(); ResetVisited();