Skip to content

Commit bfc261b

Browse files
committed
Drop StopBBReachable set
1 parent 6f59de3 commit bfc261b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Analysis/CFG.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ static bool isReachableImpl(SmallVectorImpl<BasicBlock *> &Worklist,
137137
const DominatorTree *DT, const LoopInfo *LI) {
138138
// When a stop block is unreachable, it's dominated from everywhere,
139139
// regardless of whether there's a path between the two blocks.
140-
SmallPtrSet<const BasicBlock *, 2> StopBBReachable;
141140
if (DT) {
142141
for (auto *BB : StopSet) {
143-
if (DT->isReachableFromEntry(BB))
144-
StopBBReachable.insert(BB);
142+
if (!DT->isReachableFromEntry(BB)) {
143+
DT = nullptr;
144+
break;
145+
}
145146
}
146147
}
147148

@@ -182,7 +183,7 @@ static bool isReachableImpl(SmallVectorImpl<BasicBlock *> &Worklist,
182183
continue;
183184
if (DT) {
184185
if (llvm::any_of(StopSet, [&](const BasicBlock *StopBB) {
185-
return StopBBReachable.contains(BB) && DT->dominates(BB, StopBB);
186+
return DT->dominates(BB, StopBB);
186187
}))
187188
return true;
188189
}

0 commit comments

Comments
 (0)