[PATCH] D116610: [ADCE][NFC] Batch DT updates together

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 13:41:25 PST 2022


qcolombet updated this revision to Diff 397701.
qcolombet added a comment.

- Set the default smallvector size to 10


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116610

Files:
  llvm/lib/Transforms/Scalar/ADCE.cpp


Index: llvm/lib/Transforms/Scalar/ADCE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/ADCE.cpp
+++ llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -579,6 +579,7 @@
   // Don't compute the post ordering unless we needed it.
   bool HavePostOrder = false;
   bool Changed = false;
+  SmallVector<DominatorTree::UpdateType, 10> DeletedEdges;
 
   for (auto *BB : BlocksWithDeadTerminators) {
     auto &Info = BlockInfo[BB];
@@ -617,7 +618,6 @@
     makeUnconditional(BB, PreferredSucc->BB);
 
     // Inform the dominators about the deleted CFG edges.
-    SmallVector<DominatorTree::UpdateType, 4> DeletedEdges;
     for (auto *Succ : RemovedSuccessors) {
       // It might have happened that the same successor appeared multiple times
       // and the CFG edge wasn't really removed.
@@ -629,13 +629,14 @@
       }
     }
 
-    DomTreeUpdater(DT, &PDT, DomTreeUpdater::UpdateStrategy::Eager)
-        .applyUpdates(DeletedEdges);
-
     NumBranchesRemoved += 1;
     Changed = true;
   }
 
+  if (!DeletedEdges.empty())
+    DomTreeUpdater(DT, &PDT, DomTreeUpdater::UpdateStrategy::Eager)
+        .applyUpdates(DeletedEdges);
+
   return Changed;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116610.397701.patch
Type: text/x-patch
Size: 1203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220105/d5511220/attachment.bin>


More information about the llvm-commits mailing list