Skip to content

Commit 423fef0

Browse files
Merge pull request #82027 from aschwaighofer/fix_looprotate_densemap_subscript_bug_6.2
[6.2] LoopRotate: Fix a by reference map bug under reallocation
2 parents fa4c30e + 300ba4c commit 423fef0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILOptimizer/LoopTransforms/LoopRotate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ static bool rotateLoop(SILLoop *loop, DominanceInfo *domInfo,
428428

429429
for (auto &inst : *header) {
430430
if (auto *bfi = dyn_cast<BorrowedFromInst>(&inst)) {
431-
valueMap[bfi] = valueMap[bfi->getBorrowedValue()];
431+
auto mappedValue = valueMap[bfi->getBorrowedValue()];
432+
valueMap[bfi] = mappedValue;
432433
} else if (SILInstruction *cloned = inst.clone(preheaderBranch)) {
433434
mapOperands(cloned, valueMap);
434435

0 commit comments

Comments
 (0)