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 !6 { 8 %add = add i32 %a, 2, !dbg !12 9 call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !12 10 %sub = sub i32 %add, %b, !dbg !13 11 call void @llvm.dbg.value(metadata i32 %sub, metadata !11, metadata !DIExpression()), !dbg !13 12 ret i32 %sub, !dbg !14 13 } 14 ; CHECK-LABEL: define i32 @test(i32 %a, i32 %b) { 15 ; CHECK-NEXT: %add = add i32 %a, 2 16 ; CHECK-NEXT: %sub = sub i32 %add, %b 17 ; CHECK-NEXT: ret i32 %sub 18 ; CHECK-NEXT: } 19 20 ; Function Attrs: nounwind readnone speculatable willreturn 21 declare void @llvm.dbg.value(metadata, metadata, metadata) #0 22 23 ; Function Attrs: nounwind 24 declare void @llvm.stackprotector(i8*, i8**) #1 25 26 attributes #0 = { nounwind readnone speculatable willreturn } 27 attributes #1 = { nounwind } 28 29 !llvm.dbg.cu = !{!0} 30 ; CHECK-NOT: !llvm.dbg.cu 31 !llvm.debugify = !{!3, !4} 32 ; CHECK-NOT: !llvm.debugify 33 !llvm.module.flags = !{!5} 34 ; CHECK-NOT: !llvm.module.flags 35 36 ; CHECK-NOT: !DI 37 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 38 !1 = !DIFile(filename: "<stdin>", directory: "/") 39 !2 = !{} 40 !3 = !{i32 3} 41 !4 = !{i32 2} 42 !5 = !{i32 2, !"Debug Info Version", i32 3} 43 !6 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8) 44 !7 = !DISubroutineType(types: !2) 45 !8 = !{!9, !11} 46 !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) 47 !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) 48 !11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 2, type: !10) 49 !12 = !DILocation(line: 1, column: 1, scope: !6) 50 !13 = !DILocation(line: 2, column: 1, scope: !6) 51 !14 = !DILocation(line: 3, column: 1, scope: !6) 52 53... 54--- 55name: test 56body: | 57 bb.1 (%ir-block.0): 58 %0:_(s32) = G_IMPLICIT_DEF 59 %1:_(s32) = G_IMPLICIT_DEF 60 %2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !6) 61 %3:_(s32) = G_ADD %0, %2, debug-location !12 62 DBG_VALUE %3(s32), $noreg, !9, !DIExpression(), debug-location !12 63 %4:_(s32) = G_SUB %3, %1, debug-location !13 64 DBG_VALUE %4(s32), $noreg, !11, !DIExpression(), debug-location !13 65 66 ; CHECK-LABEL: body: 67 ; CHECK-NEXT: bb 68 ; CHECK-NEXT: %0:_(s32) = G_IMPLICIT_DEF{{$}} 69 ; CHECK-NEXT: %1:_(s32) = G_IMPLICIT_DEF{{$}} 70 ; CHECK-NEXT: %2:_(s32) = G_CONSTANT i32 2{{$}} 71 ; CHECK-NEXT: %3:_(s32) = G_ADD %0, %2{{$}} 72 ; CHECK-NEXT: %4:_(s32) = G_SUB %3, %1{{$}} 73... 74