Skip to content

Commit a5a11dc

Browse files
committed
Call salvageLoadDebugInfo from splitAggregateLoad
Fixes a know issue in which load splitting drops debug info. After splitting the load, create a new debug_value instruction for the loaded memory location, inserting a dereference expression if needed. This fixes debug information for -Onone debugging. Later, after fixing optimizations, it will also be called at -O, but not on 5.9. Fixes rdar://104700920 (At -Onone preserve debug info after splitting loads) Issue: LLDB missing variables in certain case #62241 (cherry picked from commit 5d3793d)
1 parent 9a4935c commit a5a11dc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILOptimizer/Utils/CanonicalizeInstruction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ splitAggregateLoad(LoadOperation loadInst, CanonicalizeInstruction &pass) {
336336
nextII = killInstruction(extract, nextII, pass);
337337
}
338338

339+
// Preserve the original load's debug information.
340+
if (pass.preserveDebugInfo) {
341+
swift::salvageLoadDebugInfo(loadInst);
342+
}
339343
// Remove the now unused borrows.
340344
for (auto *borrow : borrows)
341345
nextII = killInstAndIncidentalUses(borrow, nextII, pass);

0 commit comments

Comments
 (0)