File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -441,10 +441,23 @@ void TypeTreeLeafTypeRange::constructFilteredProjections(
441441 callback) {
442442 auto *fn = insertPt->getFunction ();
443443 SILType type = value->getType ();
444- auto loc =
445- (insertPt->getLoc ().getKind () != SILLocation::ArtificialUnreachableKind)
446- ? insertPt->getLoc ()
447- : RegularLocation::getAutoGeneratedLocation ();
444+
445+ // Create a debug location appropriate for synthesizing projection
446+ // instructions that satisfy `SILInstruction::verifyDebugInfo`, while
447+ // trying to preserve debug info when it's valid to do so.
448+ auto projectionLocFrom = [](SILInstruction *orig) -> SILLocation {
449+ auto loc = orig->getLoc ();
450+ switch (loc.getKind ()) {
451+ case SILLocation::ReturnKind:
452+ case SILLocation::ImplicitReturnKind:
453+ case SILLocation::ArtificialUnreachableKind:
454+ return RegularLocation::getDebugOnlyLocation (loc, orig->getModule ());
455+
456+ default :
457+ return loc;
458+ }
459+ };
460+ SILLocation loc = projectionLocFrom (insertPt);
448461
449462 PRUNED_LIVENESS_LOG (llvm::dbgs () << " ConstructFilteredProjection. Bv: "
450463 << filterBitVector << ' \n ' );
You can’t perform that action at this time.
0 commit comments