Skip to content

Commit ef9446b

Browse files
authored
[GVN] lazily update dominator tree when merge unconditional branches in function (#88477)
With this change, the wall time for of GVN pass decreased from 873,745.492 ms to 367,375.304 ms in an our internal testcase.
1 parent fad3752 commit ef9446b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,7 @@ bool GVNPass::runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT,
27082708
bool Changed = false;
27092709
bool ShouldContinue = true;
27102710

2711-
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
2711+
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
27122712
// Merge unconditional branches, allowing PRE to catch more
27132713
// optimization opportunities.
27142714
for (BasicBlock &BB : llvm::make_early_inc_range(F)) {
@@ -2718,6 +2718,7 @@ bool GVNPass::runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT,
27182718

27192719
Changed |= removedBlock;
27202720
}
2721+
DTU.flush();
27212722

27222723
unsigned Iteration = 0;
27232724
while (ShouldContinue) {

0 commit comments

Comments
 (0)