Skip to content

Commit 70f7003

Browse files
committed
[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.
removeUnreachableBlocks knows how to preserve the DomTree, so make use of it instead of re-computing the DT. Reviewers: davide, kuhar, brzycki Reviewed By: davide, kuhar Differential Revision: https://reviews.llvm.org/D68298 llvm-svn: 373430
1 parent 167b052 commit 70f7003

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

llvm/lib/Transforms/IPO/GlobalOpt.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,14 +2285,10 @@ OptimizeFunctions(Module &M,
22852285
// So, remove unreachable blocks from the function, because a) there's
22862286
// no point in analyzing them and b) GlobalOpt should otherwise grow
22872287
// some more complicated logic to break these cycles.
2288-
// Removing unreachable blocks might invalidate the dominator so we
2289-
// recalculate it.
22902288
if (!F->isDeclaration()) {
2291-
if (removeUnreachableBlocks(*F)) {
2292-
auto &DT = LookupDomTree(*F);
2293-
DT.recalculate(*F);
2294-
Changed = true;
2295-
}
2289+
auto &DT = LookupDomTree(*F);
2290+
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
2291+
Changed |= removeUnreachableBlocks(*F, nullptr, &DTU);
22962292
}
22972293

22982294
Changed |= processGlobal(*F, GetTLI, LookupDomTree);

0 commit comments

Comments
 (0)