File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -140,9 +140,13 @@ void swift::erasePhiArgument(SILBasicBlock *block, unsigned argIndex) {
140
140
// Determine the set of predecessors in case any predecessor has
141
141
// two edges to this block (e.g. a conditional branch where both
142
142
// sides reach this block).
143
- SmallVector<SILBasicBlock *, 8 > predBlocks (block->pred_begin (),
144
- block->pred_end ());
145
- sortUnique (predBlocks);
143
+ //
144
+ // NOTE: This needs to be a SmallSetVector since we need both uniqueness /and/
145
+ // insertion order. Otherwise non-determinism can result.
146
+ SmallSetVector<SILBasicBlock *, 8 > predBlocks;
147
+
148
+ for (auto *pred : block->getPredecessorBlocks ())
149
+ predBlocks.insert (pred);
146
150
147
151
for (auto *pred : predBlocks)
148
152
deleteEdgeValue (pred->getTerminator (), block, argIndex);
You can’t perform that action at this time.
0 commit comments