# RUN: llc -run-pass=mir-strip-debug -o - %s | FileCheck %s
# RUN: llc -run-pass=mir-strip-debug,mir-debugify,mir-strip-debug -o - %s | FileCheck %s
--- |
; ModuleID = 'loc-only.ll'
source_filename = "loc-only.ll"
define i32 @test(i32 %a, i32 %b) !dbg !6 {
%add = add i32 %a, 2, !dbg !12
call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !12
%sub = sub i32 %add, %b, !dbg !13
call void @llvm.dbg.value(metadata i32 %sub, metadata !11, metadata !DIExpression()), !dbg !13
ret i32 %sub, !dbg !14
}
; CHECK-LABEL: define i32 @test(i32 %a, i32 %b) {{(addrspace\([0-9]+\) )?}}{
; CHECK-NEXT: %add = add i32 %a, 2
; CHECK-NEXT: %sub = sub i32 %add, %b
; CHECK-NEXT: ret i32 %sub
; CHECK-NEXT: }
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
; Function Attrs: nounwind
declare void @llvm.stackprotector(ptr, ptr) #1
attributes #0 = { nounwind readnone speculatable willreturn }
attributes #1 = { nounwind }
!llvm.dbg.cu = !{!0}
; CHECK-NOT: !llvm.dbg.cu
!llvm.debugify = !{!3, !4}
; CHECK-NOT: !llvm.debugify
!llvm.module.flags = !{!5, !15}
; CHECK: !llvm.module.flags = !{!0}
; CHECK: !0 = !{i32 2, !"Another Flag", i32 3}
; CHECK-NOT: !DI
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "<stdin>", directory: "/")
!2 = !{}
!3 = !{i32 3}
!4 = !{i32 2}
!5 = !{i32 2, !"Debug Info Version", i32 3}
!6 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!7 = !DISubroutineType(types: !2)
!8 = !{!9, !11}
!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 2, type: !10)
!12 = !DILocation(line: 1, column: 1, scope: !6)
!13 = !DILocation(line: 2, column: 1, scope: !6)
!14 = !DILocation(line: 3, column: 1, scope: !6)
!15 = !{i32 2, !"Another Flag", i32 3}
...
---
name: test
body: |
bb.1 (%ir-block.0):
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !6)
%3:_(s32) = G_ADD %0, %2, debug-location !12
DBG_VALUE %3(s32), $noreg, !9, !DIExpression(), debug-location !12
%4:_(s32) = G_SUB %3, %1, debug-location !13
DBG_VALUE %4(s32), $noreg, !11, !DIExpression(), debug-location !13
; CHECK-LABEL: body:
; CHECK-NEXT: bb
; CHECK-NEXT: %0:_(s32) = G_IMPLICIT_DEF{{$}}
; CHECK-NEXT: %1:_(s32) = G_IMPLICIT_DEF{{$}}
; CHECK-NEXT: %2:_(s32) = G_CONSTANT i32 2{{$}}
; CHECK-NEXT: %3:_(s32) = G_ADD %0, %2{{$}}
; CHECK-NEXT: %4:_(s32) = G_SUB %3, %1{{$}}
...