--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
- define void @test_dbg_value() !dbg !5 {
- ; Keep the dbg metadata live by referencing it in the IR.
+ define void @test_dbg_value(i32 %a) !dbg !5 {
+ %tmp0 = add i32 %a, %a
+ call void @llvm.dbg.value(metadata i32 %tmp0, i64 0, metadata !7, metadata !9), !dbg !10
+ ret void
+ }
+
+ define void @test_dbg_value_dead(i32 %a) !dbg !5 {
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !9), !dbg !10
ret void
}
name: test_dbg_value
legalized: true
regBankSelected: true
-# CHECK: registers:
-# CHECK-NEXT: - { id: 0, class: gpr32all }
+body: |
+ bb.0:
+ liveins: %w0
+ %0:gpr(s32) = COPY %w0
+ %1:gpr(s32) = G_ADD %0, %0
+ %w0 = COPY %1(s32)
+
+ ; CHECK: %0 = COPY %w0
+ ; CHECK-NEXT: %1 = ADDWrr %0, %0
+ ; CHECK-NEXT: %w0 = COPY %1
+ ; CHECK-NEXT: DBG_VALUE debug-use %1, debug-use _, !7, !9, debug-location !10
+
+ DBG_VALUE debug-use %1(s32), debug-use _, !7, !9, debug-location !10
+...
+
+---
+# CHECK-LABEL: name: test_dbg_value_dead
+name: test_dbg_value_dead
+legalized: true
+regBankSelected: true
body: |
bb.0:
liveins: %w0
%0:gpr(s32) = COPY %w0
- ; CHECK: DBG_VALUE debug-use %0, debug-use _, !7, !9, debug-location !10
- ; CHECK: DBG_VALUE _, 0, !7, !9, debug-location !10
+ ; CHECK-NOT: COPY
+ ; CHECK: DBG_VALUE debug-use _, debug-use _, !7, !9, debug-location !10
DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
- DBG_VALUE _, 0, !7, !9, debug-location !10
...