Skip to content

Commit ba885d9

Browse files
committed
rewrite emitMissingConsumeInDiscardingContext to use BasicBlockWorkqueue
1 parent 51eaf4a commit ba885d9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyDiagnostics.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,8 @@ void DiagnosticEmitter::emitMissingConsumeInDiscardingContext(
283283
// / \ / \
284284
// d d . .
285285
//
286-
BasicBlockSet visited(destroyPoint->getFunction());
287-
std::deque<SILBasicBlock *> bfsWorklist = {destroyPoint->getParent()};
288-
while (auto *bb = bfsWorklist.front()) {
289-
visited.insert(bb);
290-
bfsWorklist.pop_front();
291-
286+
BasicBlockWorkqueue bfsWorklist = {destroyPoint->getParent()};
287+
while (auto *bb = bfsWorklist.pop()) {
292288
TermInst *term = bb->getTerminator();
293289

294290
// Looking for a block that exits the function or terminates the program.
@@ -308,8 +304,7 @@ void DiagnosticEmitter::emitMissingConsumeInDiscardingContext(
308304
}
309305

310306
for (auto *nextBB : term->getSuccessorBlocks())
311-
if (!visited.contains(nextBB))
312-
bfsWorklist.push_back(nextBB);
307+
bfsWorklist.pushIfNotVisited(nextBB);
313308
}
314309
}
315310

0 commit comments

Comments
 (0)