Skip to content

Commit 5c68404

Browse files
authored
Fix debug location is some ownership utils (#39148)
Insert point may have invalid LocationKind. Use auto-generated loc.
1 parent 4098a16 commit 5c68404

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/SILOptimizer/Utils/OwnershipOptUtils.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ OwnershipLifetimeExtender::createPlusOneCopy(SILValue value,
299299
[&](SILBasicBlock *postDomBlock) {
300300
auto front = postDomBlock->begin();
301301
SILBuilderWithScope newBuilder(front);
302-
auto *dvi = newBuilder.createDestroyValue(front->getLoc(), copy);
302+
auto loc = RegularLocation::getAutoGeneratedLocation(front->getLoc());
303+
auto *dvi = newBuilder.createDestroyValue(loc, copy);
303304
callbacks.createdNewInst(dvi);
304305
});
305306
return result;
@@ -348,9 +349,10 @@ OwnershipLifetimeExtender::createPlusOneBorrow(SILValue value,
348349
[&](SILBasicBlock *postDomBlock) {
349350
auto front = postDomBlock->begin();
350351
SILBuilderWithScope newBuilder(front);
351-
auto *ebi = newBuilder.createEndBorrow(front->getLoc(), borrow);
352+
auto loc = RegularLocation::getAutoGeneratedLocation(front->getLoc());
353+
auto *ebi = newBuilder.createEndBorrow(loc, borrow);
352354
callbacks.createdNewInst(ebi);
353-
auto *dvi = newBuilder.createDestroyValue(front->getLoc(), copy);
355+
auto *dvi = newBuilder.createDestroyValue(loc, copy);
354356
callbacks.createdNewInst(dvi);
355357
});
356358
return result;

0 commit comments

Comments
 (0)