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 3--- | 4 ; ModuleID = 'loc-only.ll' 5 source_filename = "loc-only.ll" 6 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 13 } 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 20 ; CHECK-NEXT: } 21 22 ; Function Attrs: nounwind readnone speculatable willreturn 23 declare void @llvm.dbg.value(metadata, metadata, metadata) #0 24 25 ; Function Attrs: nounwind 26 declare void @llvm.stackprotector(ptr, ptr) #1 27 28 attributes #0 = { nounwind readnone speculatable willreturn } 29 attributes #1 = { nounwind } 30 31 !llvm.dbg.cu = !{!0} 32 ; CHECK: !llvm.dbg.cu = !{!0} 33 !llvm.module.flags = !{!3} 34 ; CHECK: !llvm.module.flags = !{!3} 35 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: "/") 38 !2 = !{} 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) 42 !6 = !{!7, !9} 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) 49 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: "/") 52 ; CHECK: !2 = !{} 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) 63 64... 65--- 66name: test 67body: | 68 bb.1 (%ir-block.0): 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 76 77 ; CHECK-LABEL: body: 78 ; CHECK-NEXT: bb 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 86... 87