Skip to content

Commit 16e9d3a

Browse files
committed
[DebugInfo] [SILSROA] Fix variable scope in some cases
SILBuilderWithScope ignores the scope of the debug value and uses the scope of the next real instruction. We want to preserve the scope of the original debug value, so we pass it explicitly. (cherry picked from commit fac61c5)
1 parent c6892c5 commit 16e9d3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILOptimizer/Transforms/SILSROA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void SROAMemoryUseAnalyzer::chopUpAlloca(std::vector<AllocStackInst *> &Worklist
298298
SILInstruction *User = Operand->getUser();
299299
auto *DVI = dyn_cast<DebugValueInst>(User);
300300
assert(DVI && "getDebugUses should only return DebugValueInst");
301-
SILBuilderWithScope B(DVI);
301+
SILBuilder B(DVI, DVI->getDebugScope());
302302
std::optional<SILDebugVariable> DVIVarInfo = DVI->getVarInfo();
303303
assert(DVIVarInfo && "debug_value without debug info");
304304

0 commit comments

Comments
 (0)