Skip to content

Commit 782ce7c

Browse files
committed
Minor latent bug fix in findGuaranteedReferenceRoots.
Fix an obvious mistake that happens to not break anything in practice. Note that the argument index of a terminator result is not the same as an operand index for the terminator instruction.
1 parent 7e9b64e commit 782ce7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,10 @@ void swift::findGuaranteedReferenceRoots(SILValue value,
854854
while (auto value = worklist.pop()) {
855855
if (auto *arg = dyn_cast<SILPhiArgument>(value)) {
856856
if (auto *terminator = arg->getSingleTerminator()) {
857-
worklist.insert(terminator->getOperand(arg->getIndex()));
858-
continue;
857+
if (terminator->isTransformationTerminator()) {
858+
worklist.insert(terminator->getOperand(0));
859+
continue;
860+
}
859861
}
860862
} else if (auto *inst = value->getDefiningInstruction()) {
861863
if (auto *result =

0 commit comments

Comments
 (0)