|
33 | 33 | #include "swift/SILOptimizer/Analysis/DeadEndBlocksAnalysis.h" |
34 | 34 | #include "swift/SILOptimizer/PassManager/Transforms.h" |
35 | 35 | #include "swift/SILOptimizer/Utils/BasicBlockOptUtils.h" |
| 36 | +#include "swift/SILOptimizer/Utils/DebugOptUtils.h" |
36 | 37 | #include "swift/SILOptimizer/Utils/InstOptUtils.h" |
37 | 38 | #include "swift/SILOptimizer/Utils/StackNesting.h" |
38 | 39 | #include "llvm/ADT/MapVector.h" |
@@ -1778,7 +1779,7 @@ static void rewriteUsesOfSscalar(StructLoweringState &pass, |
1778 | 1779 | createOutlinedCopyCall(copyBuilder, address, dest, pass); |
1779 | 1780 | storeUser->eraseFromParent(); |
1780 | 1781 | } else if (auto *dbgInst = dyn_cast<DebugValueInst>(user)) { |
1781 | | - SILBuilderWithScope dbgBuilder(dbgInst); |
| 1782 | + SILBuilder dbgBuilder(dbgInst, dbgInst->getDebugScope()); |
1782 | 1783 | // Rewrite the debug_value to point to the variable in the alloca. |
1783 | 1784 | dbgBuilder.createDebugValueAddr(dbgInst->getLoc(), address, |
1784 | 1785 | *dbgInst->getVarInfo()); |
@@ -2151,9 +2152,8 @@ static void rewriteFunction(StructLoweringState &pass, |
2151 | 2152 | } else { |
2152 | 2153 | assert(currOperand->getType().isAddress() && |
2153 | 2154 | "Expected an address type"); |
2154 | | - SILBuilderWithScope debugBuilder(instr); |
2155 | 2155 | // SILBuilderWithScope skips over metainstructions. |
2156 | | - debugBuilder.setCurrentDebugScope(instr->getDebugScope()); |
| 2156 | + SILBuilder debugBuilder(instr, instr->getDebugScope()); |
2157 | 2157 | debugBuilder.createDebugValueAddr(instr->getLoc(), currOperand, |
2158 | 2158 | *instr->getVarInfo()); |
2159 | 2159 | instr->getParent()->erase(instr); |
@@ -3655,6 +3655,7 @@ class AssignAddressToDef : SILInstructionVisitor<AssignAddressToDef> { |
3655 | 3655 |
|
3656 | 3656 | builder.createCopyAddr(load->getLoc(), load->getOperand(), addr, IsTake, |
3657 | 3657 | IsInitialization); |
| 3658 | + swift::salvageLoadDebugInfo(load); |
3658 | 3659 | assignment.markForDeletion(load); |
3659 | 3660 | } |
3660 | 3661 |
|
|
0 commit comments