Skip to content

Commit 7859ff8

Browse files
committed
SIL: fix a use-list iteration problem in replacePhiArgumentAndReplaceAllUses()
1 parent 031ed87 commit 7859ff8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SIL/IR/SILBasicBlock.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ SILPhiArgument *SILBasicBlock::replacePhiArgumentAndReplaceAllUses(
226226
// any uses.
227227
SmallVector<Operand *, 16> operands;
228228
SILValue undef = SILUndef::get(ty, *getParent());
229-
for (auto *use : getArgument(i)->getUses()) {
229+
SILArgument *arg = getArgument(i);
230+
while (!arg->use_empty()) {
231+
Operand *use = *arg->use_begin();
230232
use->set(undef);
231233
operands.push_back(use);
232234
}

0 commit comments

Comments
 (0)