Skip to content

Commit 8c1cc1b

Browse files
authored
Merge pull request #85120 from kavon/6.2-fspl-debuginfo-rdar163281183
[6.2] DebugInfo: fix FSPL SILLocation assertion issue
2 parents c6314a3 + e6694c1 commit 8c1cc1b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,23 @@ void TypeTreeLeafTypeRange::constructFilteredProjections(
434434
callback) {
435435
auto *fn = insertPt->getFunction();
436436
SILType type = value->getType();
437-
auto loc =
438-
(insertPt->getLoc().getKind() != SILLocation::ArtificialUnreachableKind)
439-
? insertPt->getLoc()
440-
: RegularLocation::getAutoGeneratedLocation();
437+
438+
// Create a debug location appropriate for synthesizing projection
439+
// instructions that satisfy `SILInstruction::verifyDebugInfo`, while
440+
// trying to preserve debug info when it's valid to do so.
441+
auto projectionLocFrom = [](SILInstruction *orig) -> SILLocation {
442+
auto loc = orig->getLoc();
443+
switch (loc.getKind()) {
444+
case SILLocation::ReturnKind:
445+
case SILLocation::ImplicitReturnKind:
446+
case SILLocation::ArtificialUnreachableKind:
447+
return RegularLocation::getDebugOnlyLocation(loc, orig->getModule());
448+
449+
default:
450+
return loc;
451+
}
452+
};
453+
SILLocation loc = projectionLocFrom(insertPt);
441454

442455
PRUNED_LIVENESS_LOG(llvm::dbgs() << "ConstructFilteredProjection. Bv: "
443456
<< filterBitVector << '\n');

0 commit comments

Comments
 (0)