diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_strldr.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_strldr.cpp index f0fbbb5ca1e86840c6b611578efee722976a52ce..8b28d3355a89a896949ce39228fd80c228e472ea 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_strldr.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_strldr.cpp @@ -355,6 +355,20 @@ bool AArch64StoreLoadOpt::CheckReplaceReg(Insn &defInsn, Insn &currInsn, InsnSet tmpInsn = tmpInsn->GetNext(); } } else { + regno_t defRegno = static_cast(defInsn.GetOperand(kInsnFirstOpnd)).GetRegisterNumber(); + if (defRegno == replaceRegNo) { + uint32 defLoopId = 0; + uint32 curLoopId = 0; + if (defInsn.GetBB()->GetLoop()) { + defLoopId = defInsn.GetBB()->GetLoop()->GetHeader()->GetId(); + } + if (currInsn.GetBB()->GetLoop()) { + curLoopId = currInsn.GetBB()->GetLoop()->GetHeader()->GetId(); + } + if (defLoopId != curLoopId) { + return false; + } + } AArch64ReachingDefinition *a64RD = static_cast(cgFunc.GetRD()); if (a64RD->HasRegDefBetweenInsnGlobal(replaceRegNo, defInsn, currInsn)) { return false; diff --git a/src/mapleall/maple_be/src/cg/loop.cpp b/src/mapleall/maple_be/src/cg/loop.cpp index e3f6ca5173d42959ab574704abc9bbe1bd5b7c2e..66dc0b4f50be6435cf1082c35af7c83e925700ad 100644 --- a/src/mapleall/maple_be/src/cg/loop.cpp +++ b/src/mapleall/maple_be/src/cg/loop.cpp @@ -635,7 +635,7 @@ bool CgLoopAnalysis::PhaseRun(maplebe::CGFunc &f) { /* do dot gen after detection so the loop backedge can be properly colored using the loop info */ DotGenerator::GenerateDot("buildloop", f, f.GetMirModule(), true, f.GetName()); } -#if DEBUG +#if xDEBUG for (const auto *lp : f.GetLoops()) { lp->CheckLoops(); } diff --git a/src/mapleall/maple_be/src/cg/strldr.cpp b/src/mapleall/maple_be/src/cg/strldr.cpp index d30abcee83d83ae7b441004d76b6b11a19281e7c..f1334e4431d7202865fa02eba2687bedee74e5de 100644 --- a/src/mapleall/maple_be/src/cg/strldr.cpp +++ b/src/mapleall/maple_be/src/cg/strldr.cpp @@ -39,6 +39,7 @@ bool CgStoreLoadOpt::PhaseRun(maplebe::CGFunc &f) { GetAnalysisInfoHook()->ForceEraseAnalysisPhase(f.GetUniqueID(), &CgReachingDefinition::id); return false; } + GetAnalysisInfoHook()->ForceRunAnalysisPhase, CGFunc>(&CgLoopAnalysis::id, f); StoreLoadOpt *storeLoadOpt = nullptr; #if TARGAARCH64 || TARGRISCV64