@@ -1777,7 +1777,9 @@ bool DataflowState::process(
17771777 if (auto debug = DebugVarCarryingInst::getFromValue (address)) {
17781778 debug.markAsMoved ();
17791779 if (auto varInfo = debug.getVarInfo ()) {
1780- builder.createDebugValue (
1780+ SILBuilderWithScope undefBuilder (builder);
1781+ undefBuilder.setCurrentDebugScope (debug.inst ->getDebugScope ());
1782+ undefBuilder.createDebugValue (
17811783 debug.inst ->getLoc (),
17821784 SILUndef::get (address->getType (), builder.getModule ()), *varInfo,
17831785 false /* poison*/ , true /* was moved*/ );
@@ -1923,7 +1925,9 @@ static bool performSingleBasicBlockAnalysis(DataflowState &dataflowState,
19231925 // Also, mark the alloc_stack as being moved at some point.
19241926 if (auto debug = DebugVarCarryingInst::getFromValue (address)) {
19251927 if (auto varInfo = debug.getVarInfo ()) {
1926- builder.createDebugValue (
1928+ SILBuilderWithScope undefBuilder (builder);
1929+ undefBuilder.setCurrentDebugScope (debug.inst ->getDebugScope ());
1930+ undefBuilder.createDebugValue (
19271931 debug.inst ->getLoc (),
19281932 SILUndef::get (address->getType (), builder.getModule ()), *varInfo,
19291933 false ,
@@ -2031,11 +2035,15 @@ static bool performSingleBasicBlockAnalysis(DataflowState &dataflowState,
20312035 IsInitialization);
20322036 if (auto debug = DebugVarCarryingInst::getFromValue (address)) {
20332037 if (auto varInfo = debug.getVarInfo ()) {
2034- builder.createDebugValue (
2035- debug.inst ->getLoc (),
2036- SILUndef::get (address->getType (), builder.getModule ()), *varInfo,
2037- false ,
2038+ {
2039+ SILBuilderWithScope undefBuilder (builder);
2040+ undefBuilder.setCurrentDebugScope (debug.inst ->getDebugScope ());
2041+ undefBuilder.createDebugValue (
2042+ debug.inst ->getLoc (),
2043+ SILUndef::get (address->getType (), builder.getModule ()), *varInfo,
2044+ false ,
20382045 /* was moved*/ true );
2046+ }
20392047 {
20402048 // Make sure at the reinit point to create a new debug value after the
20412049 // reinit instruction so we reshow the variable.
@@ -2078,7 +2086,9 @@ static bool performSingleBasicBlockAnalysis(DataflowState &dataflowState,
20782086 dumpBitVector (llvm::dbgs (), bitVector); llvm::dbgs () << ' \n ' );
20792087 if (auto debug = DebugVarCarryingInst::getFromValue (address)) {
20802088 if (auto varInfo = debug.getVarInfo ()) {
2081- builder.createDebugValue (
2089+ SILBuilderWithScope undefBuilder (builder);
2090+ undefBuilder.setCurrentDebugScope (debug.inst ->getDebugScope ());
2091+ undefBuilder.createDebugValue (
20822092 debug.inst ->getLoc (),
20832093 SILUndef::get (address->getType (), builder.getModule ()), *varInfo,
20842094 false ,
0 commit comments