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 @@ -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 ' );
You can’t perform that action at this time.
0 commit comments