[PATCH] D68298: [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 14:11:10 PDT 2019
fhahn created this revision.
fhahn added reviewers: davide, kuhar, brzycki.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
removeUnreachableBlocks knows how to preserve the DomTree, so make use
of it instead of re-computing the DT.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68298
Files:
llvm/lib/Transforms/IPO/GlobalOpt.cpp
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2285,14 +2285,10 @@
// So, remove unreachable blocks from the function, because a) there's
// no point in analyzing them and b) GlobalOpt should otherwise grow
// some more complicated logic to break these cycles.
- // Removing unreachable blocks might invalidate the dominator so we
- // recalculate it.
if (!F->isDeclaration()) {
- if (removeUnreachableBlocks(*F)) {
- auto &DT = LookupDomTree(*F);
- DT.recalculate(*F);
- Changed = true;
- }
+ auto &DT = LookupDomTree(*F);
+ DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
+ Changed |= removeUnreachableBlocks(*F, &DTU);
}
Changed |= processGlobal(*F, GetTLI, LookupDomTree);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68298.222703.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/dece4fee/attachment.bin>
More information about the llvm-commits
mailing list