Skip to content

Commit 50a0b91

Browse files
committed
[move-function] Propagate debug_value undef rather than treat it as an invalidation.
The reason that I am doing this is that otherwise in funclets we may show an invalidated value being available if we have an llvm.dbg.addr for a reinit value later in the funclet. This ensures that we have the undef at the beginning of the funclet so before that llvm.dbg.addr we will properly show no value.
1 parent 7091c87 commit 50a0b91

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

lib/SILOptimizer/Mandatory/DebugInfoCanonicalizer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,6 @@ bool DebugInfoCanonicalizer::process() {
214214
continue;
215215
}
216216

217-
// If we have a SILUndef, mark this debug info as being mapped to
218-
// nullptr.
219-
if (isa<SILUndef>(dvi->getOperand())) {
220-
LLVM_DEBUG(llvm::dbgs() << " SILUndef.\n");
221-
auto iter = state.debugValues.insert({*debugInfo, nullptr});
222-
if (!iter.second)
223-
iter.first->second = nullptr;
224-
continue;
225-
}
226-
227217
// Otherwise, we may have a new debug_value to track. Try to begin
228218
// tracking it...
229219
auto iter = state.debugValues.insert({*debugInfo, dvi});

test/DebugInfo/move_function_dbginfo_async.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public func letSimpleTest<T>(_ msg: __owned T) async {
146146
// DWARF-NEXT: [0x{{[a-f0-9]+}}, 0x{{[a-f0-9]+}}):
147147
// DWARF-SAME: DW_OP_entry_value(DW_OP_reg14 R14), DW_OP_plus_uconst 0x[[MSG_LOC]], DW_OP_plus_uconst 0x8, DW_OP_deref
148148
// DWARF-NEXT: [0x{{[a-f0-9]+}}, 0x{{[a-f0-9]+}})
149+
// DWARF-SAME: DW_OP_breg{{.*}}, DW_OP_deref, DW_OP_plus_uconst 0x[[MSG_LOC]], DW_OP_plus_uconst 0x8, DW_OP_deref
150+
// DWARF-NEXT: [0x{{[a-f0-9]+}}, 0x{{[a-f0-9]+}})
149151
// DWARF-SAME: DW_OP_breg{{.*}}, DW_OP_deref, DW_OP_plus_uconst 0x[[MSG_LOC]], DW_OP_plus_uconst 0x8, DW_OP_deref)
150152
// DWARF-NEXT: DW_AT_name ("msg")
151153
//

test/SILOptimizer/debuginfo_canonicalizer.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ bb3:
113113
// CHECK: [[BB_RHS]]:
114114
// CHECK-NEXT: debug_value [moved] undef
115115
// CHECK-NEXT: abort_apply
116+
// CHECK-NEXT: debug_value [moved] undef
116117
// CHECK-NEXT: br [[BB_CONT]]
117118
// CHECK: } // end sil function 'testUndefDiamond'
118119
sil @testUndefDiamond : $@convention(thin) (@guaranteed Klass) -> () {

0 commit comments

Comments
 (0)