Skip to content

Commit f5d47c3

Browse files
committed
Fix debug location while creating instructions in RLE
The insert point may not have RegularKind debug location. So, use an auto-generated RegularKind debug location.
1 parent bb0c6b3 commit f5d47c3

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

include/swift/SILOptimizer/Utils/LoadStoreOptUtils.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ class LSValue : public LSBase {
271271
Res = makeCopiedValueAvailable(Res, Inst->getParent());
272272
Builder.emitEndBorrowOperation(InsertPt->getLoc(), Val);
273273
// Insert a destroy on the Base
274-
SILBuilderWithScope(Inst).emitDestroyValueOperation(Inst->getLoc(), Base);
274+
SILBuilderWithScope builder(Inst);
275+
builder.emitDestroyValueOperation(
276+
RegularLocation::getAutoGeneratedLocation(), Base);
275277
}
276278
return Res;
277279
}

lib/SILOptimizer/Utils/InstOptUtils.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,8 +1983,9 @@ SILValue swift::makeCopiedValueAvailable(SILValue value, SILBasicBlock *inBlock)
19831983
return value;
19841984

19851985
auto insertPt = getInsertAfterPoint(value).getValue();
1986-
auto *copy =
1987-
SILBuilderWithScope(insertPt).createCopyValue(insertPt->getLoc(), value);
1986+
SILBuilderWithScope builder(insertPt);
1987+
auto *copy = builder.createCopyValue(
1988+
RegularLocation::getAutoGeneratedLocation(), value);
19881989

19891990
return makeNewValueAvailable(copy, inBlock);
19901991
}
@@ -2009,13 +2010,15 @@ SILValue swift::makeNewValueAvailable(SILValue value, SILBasicBlock *inBlock) {
20092010
assert(loopBlock == inBlock);
20102011
auto front = loopBlock->begin();
20112012
SILBuilderWithScope newBuilder(front);
2012-
controlEqCopy = newBuilder.createCopyValue(front->getLoc(), value);
2013+
controlEqCopy = newBuilder.createCopyValue(
2014+
RegularLocation::getAutoGeneratedLocation(), value);
20132015
},
20142016
[&](SILBasicBlock *postDomBlock) {
20152017
// Insert a destroy_value in the leaking block
20162018
auto front = postDomBlock->begin();
20172019
SILBuilderWithScope newBuilder(front);
2018-
newBuilder.createDestroyValue(front->getLoc(), value);
2020+
newBuilder.createDestroyValue(
2021+
RegularLocation::getAutoGeneratedLocation(), value);
20192022
});
20202023

20212024
return controlEqCopy ? controlEqCopy : value;

0 commit comments

Comments
 (0)