From d3734a66e02da35e8d0f6bb9acc39d540a75e1ec Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Wed, 22 May 2024 12:16:30 +0200 Subject: [PATCH] Fix complex loop intercode index reversal --- oscar64/InterCode.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index b514744..6c335ed 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -14333,6 +14333,12 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar mins->mDst.mRange.SetLimit(num, num); mLoopPrefix->mInstructions.Insert(mLoopPrefix->mInstructions.Size() - 1, mins); + for (int k = 0; k < body.Size(); k++) + { + if (body[k]->mEntryValueRange.Size()) + body[k]->mEntryValueRange[ai->mSrc[1].mTemp].SetLimit(1, num); + } + if (mEntryValueRange.Size()) mEntryValueRange[ai->mSrc[1].mTemp].SetLimit(1, num); @@ -20679,7 +20685,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "main"); + CheckFunc = !strcmp(mIdent->mString, "RenderLogo"); CheckCase = false; mEntryBlock = mBlocks[0]; @@ -21399,8 +21405,6 @@ void InterCodeProcedure::Close(void) BuildDataFlowSets(); - CheckCase = true; - ResetVisited(); mEntryBlock->SingleBlockLoopOptimisation(mParamAliasedSet, mModule->mGlobalVars); @@ -21479,9 +21483,6 @@ void InterCodeProcedure::Close(void) PeepholeOptimization(); DisassembleDebug("Peephole Temp Check"); - - if (i == 1) - CheckCase = true; RemoveUnusedInstructions();