diff options
| author | Florian Hahn <flo@fhahn.com> | 2019-10-02 08:15:31 +0000 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2019-10-02 08:15:31 +0000 |
| commit | 70f70035484ba199a329f9f8d9bd67e37bc2b408 (patch) | |
| tree | 7d2145a2ff101d05eb03483526d21bd54424483b | |
| parent | 167b0529be766a85db3c0811607ac60f821670ff (diff) | |
| download | bcm5719-llvm-70f70035484ba199a329f9f8d9bd67e37bc2b408.tar.gz bcm5719-llvm-70f70035484ba199a329f9f8d9bd67e37bc2b408.zip | |
[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
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 9c7fd5e1a81..dfbb3e78e34 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -2285,14 +2285,10 @@ OptimizeFunctions(Module &M, // 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, nullptr, &DTU); } Changed |= processGlobal(*F, GetTLI, LookupDomTree); |

