9460f89baaabedc480a6ed7730d33c28cef5b36c
[oota-llvm.git] / test / DebugInfo / Mips / dsr-fixed-objects.ll
1 ; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj <%s | \
2 ; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F0
3 ; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj <%s | \
4 ; RUN:    llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F1
5
6 ; void foo(int *);
7 ;
8 ; int f0(int a, int b, int c, int d, int e) {
9 ;   int x = a + b + c + d + e;
10 ;   foo(&x);
11 ;   return x;
12 ; }
13 ;
14 ; int f1(int a, int b, int c, int d, int e) {
15 ;   int x __attribute__((aligned(16))) = a + b + c + d + e;
16 ;   foo(&x);
17 ;   return x;
18 ; }
19
20 declare void @llvm.lifetime.start(i64, i8* nocapture)
21 declare void @llvm.lifetime.end(i64, i8* nocapture)
22
23 declare void @foo(i32*)
24
25 ; F0: DW_AT_location [DW_FORM_sec_offset]   (0x00000014)
26 ; F0: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
27 ;
28 ; x -> DW_OP_reg1(51)
29 ; F0: 0x00000014: Beginning address offset: 0x0000000000000028
30 ; F0:                Ending address offset: 0x0000000000000030
31 ; F0:                 Location description: 51
32
33 define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 {
34 entry:
35   %x = alloca i32, align 4
36   tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !9, metadata !26), !dbg !27
37   tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !10, metadata !26), !dbg !28
38   tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !11, metadata !26), !dbg !29
39   tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !12, metadata !26), !dbg !30
40   tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !13, metadata !26), !dbg !31
41   %0 = bitcast i32* %x to i8*, !dbg !32
42   call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !32
43   %add = add nsw i32 %b, %a, !dbg !33
44   %add1 = add nsw i32 %add, %c, !dbg !34
45   %add2 = add nsw i32 %add1, %d, !dbg !35
46   %add3 = add nsw i32 %add2, %e, !dbg !36
47   tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !14, metadata !26), !dbg !37
48   store i32 %add3, i32* %x, align 4, !dbg !37, !tbaa !38
49   tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !26), !dbg !37
50   call void @foo(i32* nonnull %x) #4, !dbg !42
51   call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !26), !dbg !37
52   %1 = load i32, i32* %x, align 4, !dbg !43, !tbaa !38
53   call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !44
54   ret i32 %1, !dbg !45
55 }
56
57
58 ; F1: DW_AT_location [DW_FORM_sec_offset]   (0x00000033)
59 ; F1: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000006b] = "x")
60
61 ; x -> DW_OP_reg1(51)
62 ; F1: 0x00000033: Beginning address offset: 0x0000000000000080
63 ; F1:                Ending address offset: 0x0000000000000088
64 ; F1:                 Location description: 51
65
66 define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 {
67 entry:
68   %x = alloca i32, align 16
69   tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !17, metadata !26), !dbg !46
70   tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !18, metadata !26), !dbg !47
71   tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !19, metadata !26), !dbg !48
72   tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !20, metadata !26), !dbg !49
73   tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !21, metadata !26), !dbg !50
74   %0 = bitcast i32* %x to i8*, !dbg !51
75   call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !51
76   %add = add nsw i32 %b, %a, !dbg !52
77   %add1 = add nsw i32 %add, %c, !dbg !53
78   %add2 = add nsw i32 %add1, %d, !dbg !54
79   %add3 = add nsw i32 %add2, %e, !dbg !55
80   tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !22, metadata !26), !dbg !56
81   store i32 %add3, i32* %x, align 16, !dbg !56, !tbaa !38
82   tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !22, metadata !26), !dbg !56
83   call void @foo(i32* nonnull %x) #4, !dbg !57
84   call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !22, metadata !26), !dbg !56
85   %1 = load i32, i32* %x, align 16, !dbg !58, !tbaa !38
86   call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !59
87   ret i32 %1, !dbg !60
88 }
89
90 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
91
92 !llvm.dbg.cu = !{!0}
93 !llvm.module.flags = !{!23, !24}
94 !llvm.ident = !{!25}
95
96 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
97 !1 = !DIFile(filename: "test.c", directory: "/home/vk/repos/tmp/dwarf")
98 !2 = !{}
99 !3 = !{!4, !15}
100 !4 = distinct !DISubprogram(name: "f0", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, variables: !8)
101 !5 = !DISubroutineType(types: !6)
102 !6 = !{!7, !7, !7, !7, !7, !7}
103 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
104 !8 = !{!9, !10, !11, !12, !13, !14}
105 !9 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 4, type: !7)
106 !10 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 4, type: !7)
107 !11 = !DILocalVariable(name: "c", arg: 3, scope: !4, file: !1, line: 4, type: !7)
108 !12 = !DILocalVariable(name: "d", arg: 4, scope: !4, file: !1, line: 4, type: !7)
109 !13 = !DILocalVariable(name: "e", arg: 5, scope: !4, file: !1, line: 4, type: !7)
110 !14 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 5, type: !7)
111 !15 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, variables: !16)
112 !16 = !{!17, !18, !19, !20, !21, !22}
113 !17 = !DILocalVariable(name: "a", arg: 1, scope: !15, file: !1, line: 11, type: !7)
114 !18 = !DILocalVariable(name: "b", arg: 2, scope: !15, file: !1, line: 11, type: !7)
115 !19 = !DILocalVariable(name: "c", arg: 3, scope: !15, file: !1, line: 11, type: !7)
116 !20 = !DILocalVariable(name: "d", arg: 4, scope: !15, file: !1, line: 11, type: !7)
117 !21 = !DILocalVariable(name: "e", arg: 5, scope: !15, file: !1, line: 11, type: !7)
118 !22 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 12, type: !7)
119 !23 = !{i32 2, !"Dwarf Version", i32 4}
120 !24 = !{i32 2, !"Debug Info Version", i32 3}
121 !25 = !{!"clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)"}
122 !26 = !DIExpression()
123 !27 = !DILocation(line: 4, column: 12, scope: !4)
124 !28 = !DILocation(line: 4, column: 19, scope: !4)
125 !29 = !DILocation(line: 4, column: 26, scope: !4)
126 !30 = !DILocation(line: 4, column: 33, scope: !4)
127 !31 = !DILocation(line: 4, column: 40, scope: !4)
128 !32 = !DILocation(line: 5, column: 3, scope: !4)
129 !33 = !DILocation(line: 5, column: 13, scope: !4)
130 !34 = !DILocation(line: 5, column: 17, scope: !4)
131 !35 = !DILocation(line: 5, column: 21, scope: !4)
132 !36 = !DILocation(line: 5, column: 25, scope: !4)
133 !37 = !DILocation(line: 5, column: 7, scope: !4)
134 !38 = !{!39, !39, i64 0}
135 !39 = !{!"int", !40, i64 0}
136 !40 = !{!"omnipotent char", !41, i64 0}
137 !41 = !{!"Simple C/C++ TBAA"}
138 !42 = !DILocation(line: 6, column: 3, scope: !4)
139 !43 = !DILocation(line: 7, column: 10, scope: !4)
140 !44 = !DILocation(line: 8, column: 1, scope: !4)
141 !45 = !DILocation(line: 7, column: 3, scope: !4)
142 !46 = !DILocation(line: 11, column: 12, scope: !15)
143 !47 = !DILocation(line: 11, column: 19, scope: !15)
144 !48 = !DILocation(line: 11, column: 26, scope: !15)
145 !49 = !DILocation(line: 11, column: 33, scope: !15)
146 !50 = !DILocation(line: 11, column: 40, scope: !15)
147 !51 = !DILocation(line: 12, column: 3, scope: !15)
148 !52 = !DILocation(line: 12, column: 42, scope: !15)
149 !53 = !DILocation(line: 12, column: 46, scope: !15)
150 !54 = !DILocation(line: 12, column: 50, scope: !15)
151 !55 = !DILocation(line: 12, column: 54, scope: !15)
152 !56 = !DILocation(line: 12, column: 7, scope: !15)
153 !57 = !DILocation(line: 13, column: 3, scope: !15)
154 !58 = !DILocation(line: 14, column: 10, scope: !15)
155 !59 = !DILocation(line: 15, column: 1, scope: !15)
156 !60 = !DILocation(line: 14, column: 3, scope: !15)