Skip to content

Commit 6554e2e

Browse files
committed
[InstOptUtils] Salvage debug info before inst.
When salvaging debug info, it is not always permissible to create the new debug info instruction at the same location as the old instruction: the old instruction may occur after the end of the lifetime of the new debug_value operand.
1 parent 3019be9 commit 6554e2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/SILOptimizer/Utils/InstOptUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ void swift::salvageDebugInfo(SILInstruction *I) {
18651865
NewVarInfo.Type = STI->getType();
18661866

18671867
// Create a new debug_value
1868-
SILBuilder(DbgInst, DbgInst->getDebugScope())
1868+
SILBuilder(STI, DbgInst->getDebugScope())
18691869
.createDebugValue(DbgInst->getLoc(), FieldVal, NewVarInfo);
18701870
}
18711871
}
@@ -1892,7 +1892,7 @@ void swift::salvageDebugInfo(SILInstruction *I) {
18921892
continue;
18931893
VarInfo->DIExpr.prependElements(ExprElements);
18941894
// Create a new debug_value
1895-
SILBuilder(DbgInst, DbgInst->getDebugScope())
1895+
SILBuilder(IA, DbgInst->getDebugScope())
18961896
.createDebugValue(DbgInst->getLoc(), Base, *VarInfo);
18971897
}
18981898
}

0 commit comments

Comments
 (0)