1 # RUN: llc -run-pass=mir-strip-debug -o - %s | FileCheck %s
2 # RUN: llc -run-pass=mir-strip-debug,mir-debugify,mir-strip-debug -o - %s | FileCheck %s
4 ; ModuleID = 'loc-only.ll'
5 source_filename = "loc-only.ll"
7 define i32 @test(i32 %a, i32 %b) !dbg !4 {
8 %add = add i32 %a, 2, !dbg !10
9 call void @llvm.dbg.value(metadata i32 %add, metadata !7, metadata !DIExpression()), !dbg !10
10 %sub = sub i32 %add, %b, !dbg !11
11 call void @llvm.dbg.value(metadata i32 %sub, metadata !9, metadata !DIExpression()), !dbg !11
12 ret i32 %sub, !dbg !12
14 ; CHECK-LABEL: define i32 @test(i32 %a, i32 %b) {{(addrspace\([0-9]+\) )?}}!dbg !4 {
15 ; CHECK-NEXT: %add = add i32 %a, 2, !dbg !10
16 ; CHECK-NEXT: #dbg_value(i32 %add, !7, !DIExpression(), !10
17 ; CHECK-NEXT: %sub = sub i32 %add, %b, !dbg !11
18 ; CHECK-NEXT: #dbg_value(i32 %sub, !9, !DIExpression(), !11
19 ; CHECK-NEXT: ret i32 %sub, !dbg !12
22 ; Function Attrs: nounwind readnone speculatable willreturn
23 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
25 ; Function Attrs: nounwind
26 declare void @llvm.stackprotector(ptr, ptr) #1
28 attributes #0 = { nounwind readnone speculatable willreturn }
29 attributes #1 = { nounwind }
32 ; CHECK: !llvm.dbg.cu = !{!0}
33 !llvm.module.flags = !{!3}
34 ; CHECK: !llvm.module.flags = !{!3}
36 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
37 !1 = !DIFile(filename: "<stdin>", directory: "/")
39 !3 = !{i32 2, !"Debug Info Version", i32 3}
40 !4 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !6)
41 !5 = !DISubroutineType(types: !2)
43 !7 = !DILocalVariable(name: "1", scope: !4, file: !1, line: 1, type: !8)
44 !8 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
45 !9 = !DILocalVariable(name: "2", scope: !4, file: !1, line: 2, type: !8)
46 !10 = !DILocation(line: 1, column: 1, scope: !4)
47 !11 = !DILocation(line: 2, column: 1, scope: !4)
48 !12 = !DILocation(line: 3, column: 1, scope: !4)
50 ; CHECK: !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
51 ; CHECK: !1 = !DIFile(filename: "<stdin>", directory: "/")
53 ; CHECK: !3 = !{i32 2, !"Debug Info Version", i32 3}
54 ; CHECK: !4 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !6)
55 ; CHECK: !5 = !DISubroutineType(types: !2)
56 ; CHECK: !6 = !{!7, !9}
57 ; CHECK: !7 = !DILocalVariable(name: "1", scope: !4, file: !1, line: 1, type: !8)
58 ; CHECK: !8 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
59 ; CHECK: !9 = !DILocalVariable(name: "2", scope: !4, file: !1, line: 2, type: !8)
60 ; CHECK: !10 = !DILocation(line: 1, column: 1, scope: !4)
61 ; CHECK: !11 = !DILocation(line: 2, column: 1, scope: !4)
62 ; CHECK: !12 = !DILocation(line: 3, column: 1, scope: !4)
69 %0:_(s32) = G_IMPLICIT_DEF
70 %1:_(s32) = G_IMPLICIT_DEF
71 %2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !4)
72 %3:_(s32) = G_ADD %0, %2, debug-location !10
73 DBG_VALUE %3(s32), $noreg, !7, !DIExpression(), debug-location !10
74 %4:_(s32) = G_SUB %3, %1, debug-location !11
75 DBG_VALUE %4(s32), $noreg, !9, !DIExpression(), debug-location !11
79 ; CHECK-NEXT: %0:_(s32) = G_IMPLICIT_DEF{{$}}
80 ; CHECK-NEXT: %1:_(s32) = G_IMPLICIT_DEF{{$}}
81 ; CHECK-NEXT: %2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !4)
82 ; CHECK-NEXT: %3:_(s32) = G_ADD %0, %2, debug-location !10
83 ; CHECK-NEXT: DBG_VALUE %3(s32), $noreg, !7, !DIExpression(), debug-location !10
84 ; CHECK-NEXT: %4:_(s32) = G_SUB %3, %1, debug-location !11
85 ; CHECK-NEXT: DBG_VALUE %4(s32), $noreg, !9, !DIExpression(), debug-location !11