IR: Move MDLocation into place
[oota-llvm.git] / test / Transforms / StripSymbols / strip-dead-debug-info.ll
1 ; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
2
3 ; CHECK: ModuleID = '{{.*}}'
4 ; CHECK-NOT: bar
5 ; CHECK-NOT: abcd
6
7 @xyz = global i32 2
8
9 ; Function Attrs: nounwind readnone
10 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
11
12 ; Function Attrs: nounwind readnone ssp
13 define i32 @fn() #1 {
14 entry:
15   ret i32 0, !dbg !18
16 }
17
18 ; Function Attrs: nounwind readonly ssp
19 define i32 @foo(i32 %i) #2 {
20 entry:
21   tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !{}), !dbg !20
22   %.0 = load i32* @xyz, align 4
23   ret i32 %.0, !dbg !21
24 }
25
26 attributes #0 = { nounwind readnone }
27 attributes #1 = { nounwind readnone ssp }
28 attributes #2 = { nounwind readonly ssp }
29
30 !llvm.dbg.cu = !{!0}
31 !llvm.module.flags = !{!25}
32
33 !0 = !{!"0x11\001\004.2.1 (Based on Apple Inc. build 5658) (LLVM build)\001\00\000\00\001", !1, !2, !2, !23, !24, null} ; [ DW_TAG_compile_unit ] [/tmp//g.c] [DW_LANG_C89]
34 !1 = !{!"g.c", !"/tmp/"}
35 !2 = !{null}
36 !3 = !{!"0x2e\00bar\00bar\00\005\001\001\000\006\000\001\000", !1, null, !4, null, null, null, null, null} ; [ DW_TAG_subprogram ] [line 5] [local] [def] [scope 0] [bar]
37 !4 = !{!"0x15\00\000\000\000\000\000\000", !1, !5, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
38 !5 = !{!"0x29", !1}          ; [ DW_TAG_file_type ] [/tmp//g.c]
39 !6 = !{!"0x2e\00fn\00fn\00fn\006\000\001\000\006\000\001\000", !1, null, !7, null, i32 ()* @fn, null, null, null} ; [ DW_TAG_subprogram ] [line 6] [def] [scope 0] [fn]
40 !7 = !{!"0x15\00\000\000\000\000\000\000", !1, !5, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
41 !8 = !{!9}
42 !9 = !{!"0x24\00int\000\0032\0032\000\000\005", !1, !5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
43 !10 = !{!"0x2e\00foo\00foo\00foo\007\000\001\000\006\000\001\000", !1, null, !11, null, i32 (i32)* @foo, null, null, null} ; [ DW_TAG_subprogram ] [line 7] [def] [scope 0] [foo]
44 !11 = !{!"0x15\00\000\000\000\000\000\000", !1, !5, null, !12, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
45 !12 = !{!9, !9}
46 !13 = !{!"0x100\00bb\005\000", !14, !5, !9} ; [ DW_TAG_auto_variable ]
47 !14 = !{!"0xb\005\000\000", !1, !3} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
48 !15 = !{!"0x101\00i\007\000", !10, !5, !9} ; [ DW_TAG_arg_variable ]
49 !16 = !{!"0x34\00abcd\00abcd\00\002\001\001", !5, !5, !9, null, null} ; [ DW_TAG_variable ]
50 !17 = !{!"0x34\00xyz\00xyz\00\003\000\001", !5, !5, !9, i32* @xyz, null} ; [ DW_TAG_variable ]
51 !18 = !MDLocation(line: 6, scope: !19)
52 !19 = !{!"0xb\006\000\000", !1, !6} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
53 !20 = !MDLocation(line: 7, scope: !10)
54 !21 = !MDLocation(line: 10, scope: !22)
55 !22 = !{!"0xb\007\000\000", !1, !10} ; [ DW_TAG_lexical_block ] [/tmp//g.c]
56 !23 = !{!3, !6, !10}
57 !24 = !{!16, !17}
58 !25 = !{i32 1, !"Debug Info Version", i32 2}