Skip to content

Commit 62f2ffd

Browse files
committed
[NFC] ReachableBlocks: Use StackList.
Replace a SmallVector.
1 parent bace1a6 commit 62f2ffd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/SILOptimizer/Utils/BasicBlockOptUtils.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "swift/Basic/Assertions.h"
1413
#include "swift/SILOptimizer/Utils/BasicBlockOptUtils.h"
14+
#include "swift/Basic/Assertions.h"
15+
#include "swift/SIL/LoopInfo.h"
16+
#include "swift/SIL/StackList.h"
1517
#include "swift/SILOptimizer/Utils/CFGOptUtils.h"
1618
#include "swift/SILOptimizer/Utils/InstOptUtils.h"
1719
#include "swift/SILOptimizer/Utils/OwnershipOptUtils.h"
1820
#include "swift/SILOptimizer/Utils/SILSSAUpdater.h"
19-
#include "swift/SIL/LoopInfo.h"
2021

2122
using namespace swift;
2223

@@ -25,9 +26,11 @@ using namespace swift;
2526
bool ReachableBlocks::visit(function_ref<bool(SILBasicBlock *)> visitor) {
2627
// Walk over the CFG, starting at the entry block, until all reachable blocks
2728
// are visited.
28-
SILBasicBlock *entryBB = visited.getFunction()->getEntryBlock();
29-
SmallVector<SILBasicBlock *, 8> worklist = {entryBB};
30-
visited.insert(entryBB);
29+
auto *function = visited.getFunction();
30+
auto *entry = function->getEntryBlock();
31+
StackList<SILBasicBlock *> worklist(function);
32+
worklist.push_back(entry);
33+
visited.insert(entry);
3134
while (!worklist.empty()) {
3235
SILBasicBlock *bb = worklist.pop_back_val();
3336
if (!visitor(bb))

0 commit comments

Comments
 (0)