Skip to content

Commit c638a2f

Browse files
committed
IRGen: replace SmallPtrSet<SILBasicBlock *> with BasicBlockSet in emitSILFunction()
1 parent 1dc8cbb commit c638a2f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "swift/SIL/InstructionUtils.h"
3232
#include "swift/SIL/MemAccessUtils.h"
3333
#include "swift/SIL/PrettyStackTrace.h"
34+
#include "swift/SIL/SILBitfield.h"
3435
#include "swift/SIL/SILDebugScope.h"
3536
#include "swift/SIL/SILDeclRef.h"
3637
#include "swift/SIL/SILLinkage.h"
@@ -2007,7 +2008,7 @@ void IRGenSILFunction::emitSILFunction() {
20072008

20082009
// Invariant: for every block in the work queue, we have visited all
20092010
// of its dominators.
2010-
llvm::SmallPtrSet<SILBasicBlock*, 8> visitedBlocks;
2011+
BasicBlockSet visitedBlocks(CurSILFn);
20112012
SmallVector<SILBasicBlock*, 8> workQueue; // really a stack
20122013

20132014
// Queue up the entry block, for which the invariant trivially holds.
@@ -2042,15 +2043,15 @@ void IRGenSILFunction::emitSILFunction() {
20422043
// Therefore the invariant holds of all the successors, and we can
20432044
// queue them up if we haven't already visited them.
20442045
for (auto *succBB : bb->getSuccessorBlocks()) {
2045-
if (visitedBlocks.insert(succBB).second)
2046+
if (visitedBlocks.insert(succBB))
20462047
workQueue.push_back(succBB);
20472048
}
20482049
}
20492050

20502051
// If there are dead blocks in the SIL function, we might have left
20512052
// invalid blocks in the IR. Do another pass and kill them off.
20522053
for (SILBasicBlock &bb : *CurSILFn)
2053-
if (!visitedBlocks.count(&bb))
2054+
if (!visitedBlocks.contains(&bb))
20542055
LoweredBBs[&bb].bb->eraseFromParent();
20552056

20562057
}

0 commit comments

Comments
 (0)