From 6cfdc0ce5fb6b35c181161b5ff655b65f556feba Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:49:58 +0100 Subject: [PATCH] Fix removal of consecutive indexed stores in unrolled loop --- oscar64/InterCode.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 2319efe..634573c 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -4518,6 +4518,17 @@ bool InterInstruction::RemoveUnusedStaticStoreInstructions(InterCodeBasicBlock* if (mCode == IC_STORE) storeIns.Push(this); + if (mDst.mTemp >= 0) + { + int k = 0; + for (int i = 0; i < storeIns.Size(); i++) + { + if (storeIns[i]->mSrc[1].mTemp != mDst.mTemp) + storeIns[k++] = storeIns[i]; + } + storeIns.SetSize(k); + } + return changed; } @@ -20466,7 +20477,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "test3"); + CheckFunc = !strcmp(mIdent->mString, "display_game_frame"); CheckCase = false; mEntryBlock = mBlocks[0];