Parse and print DIExpressions inline to ease IR and MIR testing
Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.
This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.
See also PR22780, for making DIExpression not be an MDNode.
Reviewers: aprantl, dexonsmith, dblaikie
Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D37075
llvm-svn: 311594
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll b/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
index e832ba9..cd32cb4 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
@@ -4,41 +4,41 @@
; CHECK-LABEL: name: debug_declare
; CHECK: stack:
; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}},
-; CHECK-NEXT: callee-saved-register: '', di-variable: '!11', di-expression: '!12',
-; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !11, !12, debug-location !13
+; CHECK-NEXT: callee-saved-register: '', di-variable: '!11', di-expression: '!DIExpression()',
+; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !11, !DIExpression(), debug-location !12
define void @debug_declare(i32 %in) #0 !dbg !7 {
entry:
%in.addr = alloca i32, align 4
store i32 %in, i32* %in.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !12), !dbg !13
- call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !12), !dbg !13
- ret void, !dbg !13
+ call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !DIExpression()), !dbg !12
+ call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !DIExpression()), !dbg !12
+ ret void, !dbg !12
}
; CHECK-LABEL: name: debug_declare_vla
-; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !15, !12, debug-location !16
-define void @debug_declare_vla(i32 %in) #0 !dbg !14 {
+; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !14, !DIExpression(), debug-location !15
+define void @debug_declare_vla(i32 %in) #0 !dbg !13 {
entry:
%vla.addr = alloca i32, i32 %in
- call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !15, metadata !12), !dbg !16
- ret void, !dbg !16
+ call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !14, metadata !DIExpression()), !dbg !15
+ ret void, !dbg !15
}
; CHECK-LABEL: name: debug_value
; CHECK: [[IN:%[0-9]+]](s32) = COPY %w0
-define void @debug_value(i32 %in) #0 !dbg !17 {
+define void @debug_value(i32 %in) #0 !dbg !16 {
%addr = alloca i32
-; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !18, !12, debug-location !19
- call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !18, metadata !12), !dbg !19
+; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !17, !DIExpression(), debug-location !18
+ call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
store i32 %in, i32* %addr
-; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !18, !20, debug-location !19
- call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !18, metadata !20), !dbg !19
-; CHECK: DBG_VALUE 123, 0, !18, !12, debug-location !19
- call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !18, metadata !12), !dbg !19
-; CHECK: DBG_VALUE float 1.000000e+00, 0, !18, !12, debug-location !19
- call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !18, metadata !12), !dbg !19
-; CHECK: DBG_VALUE _, 0, !18, !12, debug-location !19
- call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !18, metadata !12), !dbg !19
+; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !17, !DIExpression(DW_OP_deref), debug-location !18
+ call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18
+; CHECK: DBG_VALUE 123, 0, !17, !DIExpression(), debug-location !18
+ call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
+; CHECK: DBG_VALUE float 1.000000e+00, 0, !17, !DIExpression(), debug-location !18
+ call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
+; CHECK: DBG_VALUE _, 0, !17, !DIExpression(), debug-location !18
+ call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
ret void
}
@@ -62,12 +62,10 @@
!9 = !{null, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !DILocalVariable(name: "in", arg: 1, scope: !7, file: !1, line: 1, type: !10)
-!12 = !DIExpression()
-!13 = !DILocation(line: 1, column: 14, scope: !7)
-!14 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
-!15 = !DILocalVariable(name: "in", arg: 1, scope: !14, file: !1, line: 1, type: !10)
-!16 = !DILocation(line: 1, column: 14, scope: !14)
-!17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
-!18 = !DILocalVariable(name: "in", arg: 1, scope: !17, file: !1, line: 1, type: !10)
-!19 = !DILocation(line: 1, column: 14, scope: !17)
-!20 = !DIExpression(DW_OP_deref)
+!12 = !DILocation(line: 1, column: 14, scope: !7)
+!13 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+!14 = !DILocalVariable(name: "in", arg: 1, scope: !13, file: !1, line: 1, type: !10)
+!15 = !DILocation(line: 1, column: 14, scope: !13)
+!16 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+!17 = !DILocalVariable(name: "in", arg: 1, scope: !16, file: !1, line: 1, type: !10)
+!18 = !DILocation(line: 1, column: 14, scope: !16)
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir
index c8a8266..4282bff 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir
@@ -5,7 +5,7 @@
define void @test_dbg_value() !dbg !5 {
; Keep the dbg metadata live by referencing it in the IR.
- call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !9), !dbg !10
+ call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !DIExpression()), !dbg !9
ret void
}
@@ -23,8 +23,7 @@
!6 = !DISubroutineType(types: !2)
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
- !9 = !DIExpression()
- !10 = !DILocation(line: 1, column: 1, scope: !5)
+ !9 = !DILocation(line: 1, column: 1, scope: !5)
...
---
@@ -37,9 +36,9 @@
bb.0:
liveins: %w0
%0:_(s32) = COPY %w0
- ; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
- DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
+ ; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
+ DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
- ; CHECK: DBG_VALUE _, 0, !7, !9, debug-location !10
- DBG_VALUE _, 0, !7, !9, debug-location !10
+ ; CHECK: DBG_VALUE _, 0, !7, !DIExpression(), debug-location !9
+ DBG_VALUE _, 0, !7, !DIExpression(), debug-location !9
...
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/select-dbg-value.mir b/llvm/test/CodeGen/AArch64/GlobalISel/select-dbg-value.mir
index 790cd65..96245e3 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/select-dbg-value.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/select-dbg-value.mir
@@ -5,12 +5,12 @@
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
+ call void @llvm.dbg.value(metadata i32 %tmp0, i64 0, metadata !7, metadata !DIExpression()), !dbg !9
ret void
}
- define void @test_dbg_value_dead(i32 %a) !dbg !11 {
- call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !9), !dbg !13
+ define void @test_dbg_value_dead(i32 %a) !dbg !10 {
+ call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !11, metadata !DIExpression()), !dbg !12
ret void
}
@@ -28,11 +28,10 @@
!6 = !DISubroutineType(types: !2)
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
- !9 = !DIExpression()
- !10 = !DILocation(line: 1, column: 1, scope: !5)
- !11 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
- !12 = !DILocalVariable(name: "in", arg: 1, scope: !11, file: !1, line: 1, type: !8)
- !13 = !DILocation(line: 1, column: 1, scope: !11)
+ !9 = !DILocation(line: 1, column: 1, scope: !5)
+ !10 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+ !11 = !DILocalVariable(name: "in", arg: 1, scope: !10, file: !1, line: 1, type: !8)
+ !12 = !DILocation(line: 1, column: 1, scope: !10)
...
---
@@ -50,9 +49,9 @@
; 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
+ ; CHECK-NEXT: DBG_VALUE debug-use %1, debug-use _, !7, !DIExpression(), debug-location !9
- DBG_VALUE debug-use %1(s32), debug-use _, !7, !9, debug-location !10
+ DBG_VALUE debug-use %1(s32), debug-use _, !7, !DIExpression(), debug-location !9
...
---
@@ -66,7 +65,7 @@
%0:gpr(s32) = COPY %w0
; CHECK-NOT: COPY
- ; CHECK: DBG_VALUE debug-use _, debug-use _, !7, !9, debug-location !10
+ ; CHECK: DBG_VALUE debug-use _, debug-use _, !7, !DIExpression(), debug-location !9
- DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
+ DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
...
diff --git a/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir b/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir
index aa6cd5a..28809d3 100644
--- a/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir
+++ b/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir
@@ -8,18 +8,18 @@
entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14
- %0 = load i32, i32* %x.addr, align 4, !dbg !15
- ret i32 %0, !dbg !15
+ call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
+ %0 = load i32, i32* %x.addr, align 4, !dbg !14
+ ret i32 %0, !dbg !14
}
define i32 @test_typed_immediates(i32 %x) #0 {
entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14
- %0 = load i32, i32* %x.addr, align 4, !dbg !15
- ret i32 %0, !dbg !15
+ call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
+ %0 = load i32, i32* %x.addr, align 4, !dbg !14
+ ret i32 %0, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
@@ -43,9 +43,8 @@
!10 = !{i32 2, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.7.0"}
!12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8)
- !13 = !DIExpression()
- !14 = !DILocation(line: 4, scope: !4)
- !15 = !DILocation(line: 8, scope: !4)
+ !13 = !DILocation(line: 4, scope: !4)
+ !14 = !DILocation(line: 8, scope: !4)
...
---
@@ -60,14 +59,14 @@
body: |
bb.0.entry:
liveins: %edi
- ; CHECK: DBG_VALUE debug-use _, 0, !11, !12, debug-location !13
- ; CHECK: %eax = COPY %0, debug-location !14
- ; CHECK: RETQ %eax, debug-location !14
+ ; CHECK: DBG_VALUE debug-use _, 0, !11, !DIExpression(), debug-location !12
+ ; CHECK: %eax = COPY %0, debug-location !13
+ ; CHECK: RETQ %eax, debug-location !13
%0 = COPY %edi
- DBG_VALUE debug-use _, 0, !12, !13, debug-location !14
+ DBG_VALUE debug-use _, 0, !12, !DIExpression(), debug-location !13
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
- %eax = COPY %0, debug-location !15
- RETQ %eax, debug-location !15
+ %eax = COPY %0, debug-location !14
+ RETQ %eax, debug-location !14
...
---
name: test_typed_immediates
@@ -83,12 +82,12 @@
liveins: %edi
%0 = COPY %edi
- ; CHECK: DBG_VALUE _, i32 0, !11, !12
- ; CHECK-NEXT: DBG_VALUE _, i64 -22, !11, !12
- ; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !11, !12
- DBG_VALUE _, i32 0, !12, !13
- DBG_VALUE _, i64 -22, !12, !13
- DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13
+ ; CHECK: DBG_VALUE _, i32 0, !DIExpression(), !12
+ ; CHECK-NEXT: DBG_VALUE _, i64 -22, !DIExpression(), !12
+ ; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !DIExpression(), !12
+ DBG_VALUE _, i32 0, !DIExpression(), !13
+ DBG_VALUE _, i64 -22, !DIExpression(), !13
+ DBG_VALUE _, i128 123492148938512984928424384934328985928, !DIExpression(), !13
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
%eax = COPY %0
RETQ %eax
diff --git a/llvm/test/CodeGen/MIR/X86/metadata-operands.mir b/llvm/test/CodeGen/MIR/X86/metadata-operands.mir
index 9d92fe5..758f303 100644
--- a/llvm/test/CodeGen/MIR/X86/metadata-operands.mir
+++ b/llvm/test/CodeGen/MIR/X86/metadata-operands.mir
@@ -8,9 +8,9 @@
entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14
- %0 = load i32, i32* %x.addr, align 4, !dbg !15
- ret i32 %0, !dbg !15
+ call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
+ %0 = load i32, i32* %x.addr, align 4, !dbg !14
+ ret i32 %0, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
@@ -34,9 +34,8 @@
!10 = !{i32 2, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.7.0"}
!12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8)
- !13 = !DIExpression()
- !14 = !DILocation(line: 4, scope: !4)
- !15 = !DILocation(line: 8, scope: !4)
+ !13 = !DILocation(line: 4, scope: !4)
+ !14 = !DILocation(line: 8, scope: !4)
...
---
@@ -52,9 +51,9 @@
bb.0.entry:
liveins: %edi
; CHECK: %0 = COPY %edi
- ; CHECK-NEXT: DBG_VALUE _, 0, !11, !12
+ ; CHECK-NEXT: DBG_VALUE _, 0, !11, !DIExpression()
%0 = COPY %edi
- DBG_VALUE _, 0, !12, ! 13
+ DBG_VALUE _, 0, !12, !DIExpression()
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
%eax = COPY %0
RETQ %eax
diff --git a/llvm/test/CodeGen/MIR/X86/stack-object-debug-info.mir b/llvm/test/CodeGen/MIR/X86/stack-object-debug-info.mir
index 445d1bd..5c70582 100644
--- a/llvm/test/CodeGen/MIR/X86/stack-object-debug-info.mir
+++ b/llvm/test/CodeGen/MIR/X86/stack-object-debug-info.mir
@@ -15,7 +15,7 @@
%1 = bitcast [256 x i8]* %y.i to i8*
call void @llvm.lifetime.end(i64 -1, i8* %1) #3
call void @llvm.lifetime.start(i64 -1, i8* %0) #3
- call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !7) #3, !dbg !8
+ call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !DIExpression()) #3, !dbg !7
br label %for.body
}
@@ -35,14 +35,13 @@
!1 = !DIFile(filename: "t.c", directory: "")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
- !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !9)
+ !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !8)
!5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
!6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
- !7 = !DIExpression()
- !8 = !DILocation(line: 0, scope: !5)
- !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !10)
- !10 = !{!11}
- !11 = !DISubrange(count: 256)
+ !7 = !DILocation(line: 0, scope: !5)
+ !8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !9)
+ !9 = !{!10}
+ !10 = !DISubrange(count: 256)
...
---
name: foo
@@ -52,17 +51,17 @@
# CHECK-LABEL: foo
# CHECK: stack:
# CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16,
-# CHECK-NEXT: callee-saved-register: '', di-variable: '!4', di-expression: '!10',
-# CHECK-NEXT: di-location: '!11' }
+# CHECK-NEXT: callee-saved-register: '', di-variable: '!4', di-expression: '!DIExpression()',
+# CHECK-NEXT: di-location: '!10' }
stack:
- { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
- di-expression: '!7', di-location: '!8' }
+ di-expression: '!DIExpression()', di-location: '!7' }
body: |
bb.0.entry:
successors: %bb.1.for.body
bb.1.for.body:
successors: %bb.1.for.body
- DBG_VALUE %stack.0.y.i, 0, !4, !7, debug-location !8
+ DBG_VALUE %stack.0.y.i, 0, !4, !DIExpression(), debug-location !7
JMP_1 %bb.1.for.body
...
diff --git a/llvm/test/CodeGen/X86/lea-opt-with-debug.mir b/llvm/test/CodeGen/X86/lea-opt-with-debug.mir
index 03a7458..5a32d7e 100644
--- a/llvm/test/CodeGen/X86/lea-opt-with-debug.mir
+++ b/llvm/test/CodeGen/X86/lea-opt-with-debug.mir
@@ -14,22 +14,22 @@
@d = common local_unnamed_addr global i32 0, align 4
@b = common local_unnamed_addr global i32 0, align 4
- define i32 @fn1() local_unnamed_addr !dbg !9 {
- %1 = load %struct.A*, %struct.A** @c, align 8, !dbg !14
- %2 = load i32, i32* @a, align 4, !dbg !14
- %3 = sext i32 %2 to i64, !dbg !14
- %4 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, !dbg !14
- %5 = ptrtoint %struct.A* %4 to i64, !dbg !14
- %6 = trunc i64 %5 to i32, !dbg !14
- store i32 %6, i32* @d, align 4, !dbg !14
- %7 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, i32 2, !dbg !15
- tail call void @llvm.dbg.value(metadata i32* %7, i64 0, metadata !12, metadata !16), !dbg !17
- br label %8, !dbg !18
+ define i32 @fn1() local_unnamed_addr !dbg !8 {
+ %1 = load %struct.A*, %struct.A** @c, align 8, !dbg !13
+ %2 = load i32, i32* @a, align 4, !dbg !13
+ %3 = sext i32 %2 to i64, !dbg !13
+ %4 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, !dbg !13
+ %5 = ptrtoint %struct.A* %4 to i64, !dbg !13
+ %6 = trunc i64 %5 to i32, !dbg !13
+ store i32 %6, i32* @d, align 4, !dbg !13
+ %7 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, i32 2, !dbg !14
+ tail call void @llvm.dbg.value(metadata i32* %7, i64 0, metadata !11, metadata !DIExpression()), !dbg !15
+ br label %8, !dbg !16
; <label>:8: ; preds = %8, %0
- %9 = load i32, i32* %7, align 4, !dbg !19
- store i32 %9, i32* @d, align 4, !dbg !19
- br label %8, !dbg !20
+ %9 = load i32, i32* %7, align 4, !dbg !17
+ store i32 %9, i32* @d, align 4, !dbg !17
+ br label %8, !dbg !18
}
; Function Attrs: nounwind readnone
@@ -39,7 +39,6 @@
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7}
- !misc = !{!8}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2)
!1 = !DIFile(filename: "test.c", directory: "")
@@ -49,19 +48,17 @@
!5 = !{i32 2, !"Dwarf Version", i32 4}
!6 = !{i32 2, !"Debug Info Version", i32 3}
!7 = !{i32 1, !"PIC Level", i32 2}
- !8 = !DIExpression(DW_OP_plus_uconst, 8, DW_OP_stack_value)
- !9 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 7, type: !10, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !0, variables: !11)
- !10 = !DISubroutineType(types: !3)
- !11 = !{!12}
- !12 = !DILocalVariable(name: "e", scope: !9, file: !1, line: 8, type: !13)
- !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64)
- !14 = !DILocation(line: 9, scope: !9)
- !15 = !DILocation(line: 10, scope: !9)
- !16 = !DIExpression()
- !17 = !DILocation(line: 8, scope: !9)
- !18 = !DILocation(line: 11, scope: !9)
- !19 = !DILocation(line: 13, scope: !9)
- !20 = !DILocation(line: 14, scope: !9)
+ !8 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 7, type: !9, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !0, variables: !10)
+ !9 = !DISubroutineType(types: !3)
+ !10 = !{!11}
+ !11 = !DILocalVariable(name: "e", scope: !8, file: !1, line: 8, type: !12)
+ !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64)
+ !13 = !DILocation(line: 9, scope: !8)
+ !14 = !DILocation(line: 10, scope: !8)
+ !15 = !DILocation(line: 8, scope: !8)
+ !16 = !DILocation(line: 11, scope: !8)
+ !17 = !DILocation(line: 13, scope: !8)
+ !18 = !DILocation(line: 14, scope: !8)
...
---
@@ -98,28 +95,28 @@
bb.0 (%ir-block.0):
successors: %bb.1(0x80000000)
- ; CHECK: %3 = LEA64r %2, 2, %2, 0, _, debug-location !14
- ; CHECK-NEXT: %4 = LEA64r %1, 4, %3, 0, _, debug-location !14
- ; CHECK-NOT: %0 = LEA64r %1, 4, %3, 8, _, debug-location !15
- ; CHECK: DBG_VALUE debug-use %4, debug-use _, !12, !8, debug-location !17
+ ; CHECK: %3 = LEA64r %2, 2, %2, 0, _, debug-location !13
+ ; CHECK-NEXT: %4 = LEA64r %1, 4, %3, 0, _, debug-location !13
+ ; CHECK-NOT: %0 = LEA64r %1, 4, %3, 8, _, debug-location !14
+ ; CHECK: DBG_VALUE debug-use %4, debug-use _, !11, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_stack_value), debug-location !15
- %1 = MOV64rm %rip, 1, _, @c, _, debug-location !14 :: (dereferenceable load 8 from @c)
- %2 = MOVSX64rm32 %rip, 1, _, @a, _, debug-location !14 :: (dereferenceable load 4 from @a)
- %3 = LEA64r %2, 2, %2, 0, _, debug-location !14
- %4 = LEA64r %1, 4, %3, 0, _, debug-location !14
- %5 = COPY %4.sub_32bit, debug-location !14
- MOV32mr %rip, 1, _, @d, _, killed %5, debug-location !14 :: (store 4 into @d)
- %0 = LEA64r %1, 4, %3, 8, _, debug-location !15
- DBG_VALUE debug-use %0, debug-use _, !12, !16, debug-location !17
+ %1 = MOV64rm %rip, 1, _, @c, _, debug-location !13 :: (dereferenceable load 8 from @c)
+ %2 = MOVSX64rm32 %rip, 1, _, @a, _, debug-location !13 :: (dereferenceable load 4 from @a)
+ %3 = LEA64r %2, 2, %2, 0, _, debug-location !13
+ %4 = LEA64r %1, 4, %3, 0, _, debug-location !13
+ %5 = COPY %4.sub_32bit, debug-location !13
+ MOV32mr %rip, 1, _, @d, _, killed %5, debug-location !13 :: (store 4 into @d)
+ %0 = LEA64r %1, 4, %3, 8, _, debug-location !14
+ DBG_VALUE debug-use %0, debug-use _, !11, !DIExpression(), debug-location !15
; CHECK-LABEL: bb.1 (%ir-block.8):
- ; CHECK: %6 = MOV32rm %4, 1, _, 8, _, debug-location !19 :: (load 4 from %ir.7)
+ ; CHECK: %6 = MOV32rm %4, 1, _, 8, _, debug-location !17 :: (load 4 from %ir.7)
bb.1 (%ir-block.8):
successors: %bb.1(0x80000000)
- %6 = MOV32rm %0, 1, _, 0, _, debug-location !19 :: (load 4 from %ir.7)
- MOV32mr %rip, 1, _, @d, _, killed %6, debug-location !19 :: (store 4 into @d)
- JMP_1 %bb.1, debug-location !20
+ %6 = MOV32rm %0, 1, _, 0, _, debug-location !17 :: (load 4 from %ir.7)
+ MOV32mr %rip, 1, _, @d, _, killed %6, debug-location !17 :: (store 4 into @d)
+ JMP_1 %bb.1, debug-location !18
...
diff --git a/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir b/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
index ba5c859..efc384d 100644
--- a/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
+++ b/llvm/test/CodeGen/X86/post-ra-sched-with-debug.mir
@@ -227,6 +227,11 @@
!47 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
!48 = !DILocation(line: 10, column: 8, scope: !40, inlinedAt: !45)
+# CHECK: ![[I_VAR:[0-9]+]] = !DILocalVariable(name: "i", {{.*}}line: 9, {{.*}})
+# CHECK: ![[I_LOC:[0-9]+]] = !DILocation(line: 9, column: 37, {{.*}})
+# CHECK: ![[J_VAR:[0-9]+]] = !DILocalVariable(name: "j", {{.*}}line: 10, {{.*}})
+# CHECK: ![[J_LOC:[0-9]+]] = !DILocation(line: 10, column: 8, {{.*}})
+
...
---
name: _ZN1sC2Ei
@@ -246,8 +251,8 @@
liveins: %esi, %rdi, %r14, %rbx, %rbp
; CHECK: [[REGISTER:%r[a-z0-9]+]] = LEA64r {{%r[a-z0-9]+}}, 1, _, -20, _
- ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, !46, !17, debug-location !48
- ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, !39, !17, debug-location !44
+ ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, ![[J_VAR]], !DIExpression(), debug-location ![[J_LOC]]
+ ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]
frame-setup PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp
CFI_INSTRUCTION def_cfa_offset 16