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