[llvm] cdd11d6 - Fix bot failures after PR #104867

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 16:13:38 PDT 2024


Author: Mircea Trofin
Date: 2024-08-23T16:13:25-07:00
New Revision: cdd11d694a406a98a16d6265168ee2fbe1b6a87c

URL: https://github.com/llvm/llvm-project/commit/cdd11d694a406a98a16d6265168ee2fbe1b6a87c
DIFF: https://github.com/llvm/llvm-project/commit/cdd11d694a406a98a16d6265168ee2fbe1b6a87c.diff

LOG: Fix bot failures after PR #104867

An assert was left over after addressing feedback. In the process of
fixing, realized the way I addressed the feedback was also incomplete.

Added: 
    

Modified: 
    llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
index 479cfc58ab38f5..07906fa1aa6c65 100644
--- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
+++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
@@ -374,32 +374,17 @@ DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
   auto &DT =
       FAM.getResult<DominatorTreeAnalysis>(const_cast<Function &>(Caller));
 
-  SetVector<const BasicBlock *> NewSucc;
-  NewSucc.insert(succ_begin(&CallSiteBB), succ_end(&CallSiteBB));
-
-  // tell the DomTree about the new edges
-  std::deque<const BasicBlock *> Worklist;
-  Worklist.push_back(&CallSiteBB);
-
-  // Build the list of edges to actually remove. Those are those edges in the
-  // DomTreeUpdates that cannot be found in the CFG anymore.
   SmallVector<DominatorTree::UpdateType, 2> FinalDomTreeUpdates;
-  while (!Worklist.empty()) {
-    auto *BB = Worklist.front();
-    Worklist.pop_front();
-    assert(DT.getNode(BB));
 
-    for (auto *Succ : NewSucc) {
-      if (!DT.getNode(Succ))
-        Worklist.push_back(Succ);
+  for (auto &Upd : DomTreeUpdates)
+    FinalDomTreeUpdates.push_back(Upd);
+
+  DenseSet<const BasicBlock *> Inserted;
+  for (auto *Succ : successors(&CallSiteBB))
+    if (Inserted.insert(Succ).second)
       FinalDomTreeUpdates.push_back({DominatorTree::UpdateKind::Insert,
-                                     const_cast<BasicBlock *>(BB),
+                                     const_cast<BasicBlock *>(&CallSiteBB),
                                      const_cast<BasicBlock *>(Succ)});
-    }
-  }
-  for (auto &Upd : DomTreeUpdates)
-    if (!llvm::is_contained(successors(Upd.getFrom()), Upd.getTo()))
-      FinalDomTreeUpdates.push_back(Upd);
 
   DT.applyUpdates(FinalDomTreeUpdates);
 #ifdef EXPENSIVE_CHECKS


        


More information about the llvm-commits mailing list