diff --git a/src/mapleall/maple_me/include/ssa_epre.h b/src/mapleall/maple_me/include/ssa_epre.h index fdd7fb7e391df2f0fa5a50ac5db698378c95442e..bb73bfe238d96d19cf756facceb5989dbfe64a0e 100644 --- a/src/mapleall/maple_me/include/ssa_epre.h +++ b/src/mapleall/maple_me/include/ssa_epre.h @@ -52,6 +52,7 @@ class SSAEPre : public SSAPre { } // here starts methods related to strength reduction bool AllVarsSameVersion(const MeRealOcc &realocc1, const MeRealOcc &realocc2) const override; + ScalarMeExpr *ResolveOneInjuringDef(ScalarMeExpr *regx) const; ScalarMeExpr *ResolveAllInjuringDefs(ScalarMeExpr *regx) const override; MeExpr *ResolveAllInjuringDefs(MeExpr *x) const override { if (!workCand->isSRCand) { diff --git a/src/mapleall/maple_me/src/me_ir.cpp b/src/mapleall/maple_me/src/me_ir.cpp index 7a5b87fc005a6db994c77b9807e498dc0c3813d8..e8839b7981dc0c11e497eaf0ace0af75fd5a6d23 100644 --- a/src/mapleall/maple_me/src/me_ir.cpp +++ b/src/mapleall/maple_me/src/me_ir.cpp @@ -796,7 +796,7 @@ void MePhiNode::Dump(const IRMap *irMap) const { ost->Dump(); } else { PregIdx regId = static_cast(lhs)->GetRegIdx(); - LogInfo::MapleLogger() << "REGVAR: " << regId; + LogInfo::MapleLogger() << "REGINDX:" << regId; LogInfo::MapleLogger() << "(%" << irMap->GetMIRModule().CurFunction() ->GetPregTab() diff --git a/src/mapleall/maple_me/src/occur.cpp b/src/mapleall/maple_me/src/occur.cpp index 7ec6eb3e2b967ac80866baf137840d89e145082f..638da0857c9bbbdd6d37f68741c19d0ee6fb58d7 100644 --- a/src/mapleall/maple_me/src/occur.cpp +++ b/src/mapleall/maple_me/src/occur.cpp @@ -230,7 +230,7 @@ uint32 PreWorkCandHashTable::ComputeWorkCandHashIndex(const MeExpr &meExpr) { case kMeOpIvar: { auto &iVar = static_cast(meExpr); hashIdx = ComputeWorkCandHashIndex(*iVar.GetBase()) + - (static_cast(iVar.GetTyIdx()) << kOffsetIvarMeExprTyIdx) + iVar.GetFieldID(); + (static_cast(iVar.GetTyIdx()) << kOffsetIvarMeExprTyIdx) + iVar.GetFieldID() + iVar.GetOffset(); break; } case kMeOpOp: { diff --git a/src/mapleall/maple_me/src/ssa_epre.cpp b/src/mapleall/maple_me/src/ssa_epre.cpp index 940ac78969cb6db6e087c8cd9c59e19ccd6e7a70..b06ce7fee8eb5f81db7ce27e667132dd0bf7cf8a 100644 --- a/src/mapleall/maple_me/src/ssa_epre.cpp +++ b/src/mapleall/maple_me/src/ssa_epre.cpp @@ -228,6 +228,14 @@ MeExpr *SSAEPre::PhiOpndFromRes(MeRealOcc &realZ, size_t j) const { MeExpr *retOpnd = GetReplaceMeExpr(*opMeExpr.GetOpnd(i), *ePhiBB, j); if (retOpnd != nullptr) { opMeExpr.SetOpnd(i, retOpnd); + } else if (workCand->isSRCand) { + ScalarMeExpr *curScalar = dynamic_cast(opMeExpr.GetOpnd(i)); + if (curScalar != nullptr) { + while (!DefVarDominateOcc(curScalar, *defZ)) { + curScalar = ResolveOneInjuringDef(curScalar); + opMeExpr.SetOpnd(i, curScalar); + } + } } } return irMap->HashMeExpr(opMeExpr); diff --git a/src/mapleall/maple_me/src/ssa_epre_for_sr.cpp b/src/mapleall/maple_me/src/ssa_epre_for_sr.cpp index 65b68d27a106cd2cbe88ae0c59ad0ceba6477ec8..6292d8a3c7dd43addf288d3c63cea936fab3a6d7 100644 --- a/src/mapleall/maple_me/src/ssa_epre_for_sr.cpp +++ b/src/mapleall/maple_me/src/ssa_epre_for_sr.cpp @@ -17,7 +17,7 @@ namespace maple { -static ScalarMeExpr* ResolveOneInjuringDef(ScalarMeExpr *regx) { +ScalarMeExpr* SSAEPre::ResolveOneInjuringDef(ScalarMeExpr *regx) const { if (regx->GetDefBy() != kDefByStmt) { return regx; }