IR: Move MDLocation into place
[oota-llvm.git] / test / DebugInfo / inlined-arguments.ll
1 ; REQUIRES: object-emission
2
3 ; RUN: %llc_dwarf -filetype=obj < %s > %t
4 ; RUN: llvm-dwarfdump %t | FileCheck %s
5
6 ; IR generated from clang -O -g with the following source
7 ;
8 ; void f1(int x, int y);
9 ; void f3(int line);
10 ; void f2() {
11 ;   f1(1, 2);
12 ; }
13 ; void f1(int x, int y) {
14 ;   f3(y);
15 ; }
16
17 ; CHECK: DW_AT_name{{.*}}"f1"
18 ; CHECK: DW_TAG_formal_parameter
19 ; CHECK-NOT: DW_TAG
20 ; CHECK: DW_AT_name{{.*}}"x"
21 ; CHECK: DW_TAG_formal_parameter
22 ; CHECK-NOT: DW_TAG
23 ; CHECK: DW_AT_name{{.*}}"y"
24
25 ; Function Attrs: uwtable
26 define void @_Z2f2v() #0 {
27   tail call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !16, metadata !{!"0x102"}), !dbg !18
28   tail call void @llvm.dbg.value(metadata i32 2, i64 0, metadata !20, metadata !{!"0x102"}), !dbg !18
29   tail call void @_Z2f3i(i32 2), !dbg !21
30   ret void, !dbg !22
31 }
32
33 ; Function Attrs: uwtable
34 define void @_Z2f1ii(i32 %x, i32 %y) #0 {
35   tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !13, metadata !{!"0x102"}), !dbg !23
36   tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !14, metadata !{!"0x102"}), !dbg !23
37   tail call void @_Z2f3i(i32 %y), !dbg !24
38   ret void, !dbg !25
39 }
40
41 declare void @_Z2f3i(i32) #1
42
43 ; Function Attrs: nounwind readnone
44 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
45
46 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
47 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
48 attributes #2 = { nounwind readnone }
49
50 !llvm.dbg.cu = !{!0}
51 !llvm.module.flags = !{!26}
52
53 !0 = !{!"0x11\004\00clang version 3.4 \001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/blaikie/dev/scratch/exp.cpp] [DW_LANG_C_plus_plus]
54 !1 = !{!"exp.cpp", !"/usr/local/google/home/blaikie/dev/scratch"}
55 !2 = !{}
56 !3 = !{!4, !8}
57 !4 = !{!"0x2e\00f2\00f2\00_Z2f2v\003\000\001\000\006\00256\001\003", !1, !5, !6, null, void ()* @_Z2f2v, null, null, !2} ; [ DW_TAG_subprogram ] [line 3] [def] [f2]
58 !5 = !{!"0x29", !1}          ; [ DW_TAG_file_type ] [/usr/local/google/home/blaikie/dev/scratch/exp.cpp]
59 !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
60 !7 = !{null}
61 !8 = !{!"0x2e\00f1\00f1\00_Z2f1ii\006\000\001\000\006\00256\001\006", !1, !5, !9, null, void (i32, i32)* @_Z2f1ii, null, null, !12} ; [ DW_TAG_subprogram ] [line 6] [def] [f1]
62 !9 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !10, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
63 !10 = !{null, !11, !11}
64 !11 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
65 !12 = !{!13, !14}
66 !13 = !{!"0x101\00x\0016777222\000", !8, !5, !11} ; [ DW_TAG_arg_variable ] [x] [line 6]
67 !14 = !{!"0x101\00y\0033554438\000", !8, !5, !11} ; [ DW_TAG_arg_variable ] [y] [line 6]
68 !15 = !{i32 undef}
69 !16 = !{!"0x101\00x\0016777222\000", !8, !5, !11, !17} ; [ DW_TAG_arg_variable ] [x] [line 6]
70 !17 = !MDLocation(line: 4, scope: !4)
71 !18 = !MDLocation(line: 6, scope: !8, inlinedAt: !17)
72 !19 = !{i32 2}
73 !20 = !{!"0x101\00y\0033554438\000", !8, !5, !11, !17} ; [ DW_TAG_arg_variable ] [y] [line 6]
74 !21 = !MDLocation(line: 7, scope: !8, inlinedAt: !17)
75 !22 = !MDLocation(line: 5, scope: !4)
76 !23 = !MDLocation(line: 6, scope: !8)
77 !24 = !MDLocation(line: 7, scope: !8)
78 !25 = !MDLocation(line: 8, scope: !8)
79 !26 = !{i32 1, !"Debug Info Version", i32 2}