diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_phases.def b/src/mapleall/maple_be/include/cg/aarch64/aarch64_phases.def index a3a74d7b2fba78318e5d5cec8bc2673a531035e7..34f20fd47b6f3b62e2203d15a1a453f4bf3ff54c 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_phases.def +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_phases.def @@ -63,7 +63,7 @@ ADDTARGETPHASE("postcfgo", CGOptions::DoCFGO()); ADDTARGETPHASE("cgpostpeephole", CGOptions::DoPeephole()) ADDTARGETPHASE("peephole", CGOptions::DoPeephole()) - ADDTARGETPHASE("gencfi", !GetMIRModule()->IsCModule() || GetMIRModule()->IsWithDbgInfo()); + ADDTARGETPHASE("gencfi", true); ADDTARGETPHASE("yieldpoint", GetMIRModule()->IsJavaModule() && CGOptions::IsInsertYieldPoint()); ADDTARGETPHASE("scheduling", CGOptions::DoSchedule()); ADDTARGETPHASE("alignanalysis", GetMIRModule()->IsCModule() && CGOptions::DoAlignAnalysis()); diff --git a/src/mapleall/maple_be/include/cg/aarch64/aarch64_proepilog.h b/src/mapleall/maple_be/include/cg/aarch64/aarch64_proepilog.h index 3769bf00c1a4611eb9747adabf37c781f4f9351e..a14cf490089155e84a1c3ecc9a068604d34108b4 100644 --- a/src/mapleall/maple_be/include/cg/aarch64/aarch64_proepilog.h +++ b/src/mapleall/maple_be/include/cg/aarch64/aarch64_proepilog.h @@ -92,11 +92,18 @@ class AArch64GenProEpilog : public GenProEpilog { BB *GetCurTailcallExitBB() { return curTailcallExitBB; } + void SetFastPathReturnBB(BB *bb) { + fastPathReturnBB = bb; + } + BB *GetFastPathReturnBB() { + return fastPathReturnBB; + } MapleAllocator tmpAlloc; static constexpr const int32 kOffset8MemPos = 8; static constexpr const int32 kOffset16MemPos = 16; MapleMap> exitBB2CallSitesMap; BB* curTailcallExitBB = nullptr; + BB* fastPathReturnBB = nullptr; bool useFP = true; /* frame pointer(x29) is available as a general-purpose register if useFP is set as false */ AArch64reg stackBaseReg = RFP; diff --git a/src/mapleall/maple_be/include/cg/cgfunc.h b/src/mapleall/maple_be/include/cg/cgfunc.h index 1994ece015dfd87005faaca556214a5d5d983d8d..a2abd60c7c0bb9026c777bcc8902560fa63af9d3 100644 --- a/src/mapleall/maple_be/include/cg/cgfunc.h +++ b/src/mapleall/maple_be/include/cg/cgfunc.h @@ -1083,7 +1083,7 @@ class CGFunc { virtual InsnVisitor *NewInsnModifier() = 0; bool GenCfi() const { - return (mirModule.GetSrcLang() != kSrcLangC) || mirModule.IsWithDbgInfo(); + return true; } MapleVector &GetDbgCallFrameLocations() { diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_proepilog.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_proepilog.cpp index 66b7c3f44c344a9c4da734900f8ecec45fd61184..8ea922dac145f9f797ba867fe9589fce25fc0bd9 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_proepilog.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_proepilog.cpp @@ -841,6 +841,7 @@ BB *AArch64GenProEpilog::IsolateFastPath(BB &bb) { tgtBB->GetPrev()->SetNext(tgtBB->GetNext()); tgtBB->GetNext()->SetPrev(tgtBB->GetPrev()); } + SetFastPathReturnBB(tgtBB); return coldBB; } @@ -2013,7 +2014,9 @@ void AArch64GenProEpilog::Run() { } for (auto *exitBB : cgFunc.GetExitBBsVec()) { - GenerateEpilog(*exitBB); + if (GetFastPathReturnBB() != exitBB) { + GenerateEpilog(*exitBB); + } } if (cgFunc.GetFunction().IsJava()) { diff --git a/src/mapleall/maple_be/src/cg/cfgo.cpp b/src/mapleall/maple_be/src/cg/cfgo.cpp index e57e75f853bd006867e35eea5d6af983550bcbd0..197d20082e3b68ab6372b6677a2f41239550bd64 100644 --- a/src/mapleall/maple_be/src/cg/cfgo.cpp +++ b/src/mapleall/maple_be/src/cg/cfgo.cpp @@ -37,7 +37,7 @@ using namespace maple; void CFGOptimizer::InitOptimizePatterns() { /* Initialize cfg optimization patterns */ - diffPassPatterns.emplace_back(memPool->New(*cgFunc)); +// diffPassPatterns.emplace_back(memPool->New(*cgFunc)); diffPassPatterns.emplace_back(memPool->New(*cgFunc)); diffPassPatterns.emplace_back(memPool->New(*cgFunc)); diffPassPatterns.emplace_back(memPool->New(*cgFunc));