aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2022-09-17 17:57:35 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2022-10-24 15:43:53 -0400
commitbd7949bcd86633bd4203b2ba6f891aea00fce4d1 (patch)
tree4137ed5f8c409d4afd02d3621a76e2ceae95b17a /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parent3637dc601c4923721a69426187aa69dd6a71a053 (diff)
downloadllvm-bd7949bcd86633bd4203b2ba6f891aea00fce4d1.zip
llvm-bd7949bcd86633bd4203b2ba6f891aea00fce4d1.tar.gz
llvm-bd7949bcd86633bd4203b2ba6f891aea00fce4d1.tar.bz2
reland e5581df60a35 [SimplifyCFG] accumulate bonus insts cost
Fixed compile time increase due to always constructing LocalCostTracker. Now only construct LocalCostTracker when needed.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 8943b4b..13f1080 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -480,6 +480,7 @@ static bool simplifyOneLoop(Loop *L, SmallVectorImpl<Loop *> &Worklist,
DominatorTree *DT, LoopInfo *LI,
ScalarEvolution *SE, AssumptionCache *AC,
MemorySSAUpdater *MSSAU, bool PreserveLCSSA) {
+ SimplifyCFGCostTracker CostTracker;
bool Changed = false;
if (MSSAU && VerifyMemorySSA)
MSSAU->getMemorySSA()->verifyMemorySSA();
@@ -661,7 +662,7 @@ ReprocessLoop:
// The block has now been cleared of all instructions except for
// a comparison and a conditional branch. SimplifyCFG may be able
// to fold it now.
- if (!FoldBranchToCommonDest(BI, /*DTU=*/nullptr, MSSAU))
+ if (!FoldBranchToCommonDest(BI, CostTracker, /*DTU=*/nullptr, MSSAU))
continue;
// Success. The block is now dead, so remove it from the loop,