Skip to content

Commit cdd11d6

Browse files
committed
Fix bot failures after PR llvm#104867
An assert was left over after addressing feedback. In the process of fixing, realized the way I addressed the feedback was also incomplete.
1 parent 91e57c6 commit cdd11d6

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -374,32 +374,17 @@ DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
374374
auto &DT =
375375
FAM.getResult<DominatorTreeAnalysis>(const_cast<Function &>(Caller));
376376

377-
SetVector<const BasicBlock *> NewSucc;
378-
NewSucc.insert(succ_begin(&CallSiteBB), succ_end(&CallSiteBB));
379-
380-
// tell the DomTree about the new edges
381-
std::deque<const BasicBlock *> Worklist;
382-
Worklist.push_back(&CallSiteBB);
383-
384-
// Build the list of edges to actually remove. Those are those edges in the
385-
// DomTreeUpdates that cannot be found in the CFG anymore.
386377
SmallVector<DominatorTree::UpdateType, 2> FinalDomTreeUpdates;
387-
while (!Worklist.empty()) {
388-
auto *BB = Worklist.front();
389-
Worklist.pop_front();
390-
assert(DT.getNode(BB));
391378

392-
for (auto *Succ : NewSucc) {
393-
if (!DT.getNode(Succ))
394-
Worklist.push_back(Succ);
379+
for (auto &Upd : DomTreeUpdates)
380+
FinalDomTreeUpdates.push_back(Upd);
381+
382+
DenseSet<const BasicBlock *> Inserted;
383+
for (auto *Succ : successors(&CallSiteBB))
384+
if (Inserted.insert(Succ).second)
395385
FinalDomTreeUpdates.push_back({DominatorTree::UpdateKind::Insert,
396-
const_cast<BasicBlock *>(BB),
386+
const_cast<BasicBlock *>(&CallSiteBB),
397387
const_cast<BasicBlock *>(Succ)});
398-
}
399-
}
400-
for (auto &Upd : DomTreeUpdates)
401-
if (!llvm::is_contained(successors(Upd.getFrom()), Upd.getTo()))
402-
FinalDomTreeUpdates.push_back(Upd);
403388

404389
DT.applyUpdates(FinalDomTreeUpdates);
405390
#ifdef EXPENSIVE_CHECKS

0 commit comments

Comments
 (0)