[PATCH] D68298: [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 01:13:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373430: [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing. (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D68298?vs=222703&id=222766#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68298/new/

https://reviews.llvm.org/D68298

Files:
  llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp


Index: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/trunk/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, nullptr, &DTU);
     }
 
     Changed |= processGlobal(*F, GetTLI, LookupDomTree);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68298.222766.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191002/51310683/attachment.bin>


More information about the llvm-commits mailing list