From c16df692d666081d8ca8eb75153fbe1c309fc158 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 2 Oct 2019 08:32:25 +0000 Subject: [PATCH] Revert [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing. This breaks http://lab.llvm.org:8011/builders/sanitizer-windows/builds/52310 This reverts r373430 (git commit 70f70035484ba199a329f9f8d9bd67e37bc2b408) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373432 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/GlobalOpt.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index dfbb3e78e34..9c7fd5e1a81 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2285,10 +2285,14 @@ 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()) { - auto &DT = LookupDomTree(*F); - DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy); - Changed |= removeUnreachableBlocks(*F, nullptr, &DTU); + if (removeUnreachableBlocks(*F)) { + auto &DT = LookupDomTree(*F); + DT.recalculate(*F); + Changed = true; + } } Changed |= processGlobal(*F, GetTLI, LookupDomTree); -- 2.40.0