Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/nophysreg.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=%triple -filetype=obj < %t.ll | llvm-dwarfdump -debug-info - | FileCheck %s
6 ;
7 ; PR22296: In this testcase the DBG_VALUE describing "p5" becomes unavailable
8 ; because the register its address is in is clobbered and we (currently) aren't
9 ; smart enough to realize that the value is rematerialized immediately after the
10 ; DBG_VALUE and/or is actually a stack slot.
11 ;
12 ; Test that we handle this situation gracefully by omitting the DW_AT_location
13 ; and not asserting.
14 ; Note that this check may XPASS in the future if DbgValueHistoryCalculator
15 ; becoms smarter. That would be fine, too.
16 ;
17 ; CHECK: DW_TAG_subprogram
18 ; CHECK: linkage_name{{.*}}_Z2f21A
19 ; CHECK: DW_TAG_formal_parameter
20 ; CHECK-NOT: DW_AT_location
21 ; CHECK-NEXT: DW_AT_name {{.*}}"p5"
22 ;
23 ; // Compile at -O1
24 ; struct A {
25 ; int *m1;
26 ; int m2;
27 ; };
28 ;
29 ; void f1(int *p1, int p2);
30 ; void __attribute__((always_inline)) f2(A p5) { f1(p5.m1, p5.m2); }
31 ;
32 ; void func(void*);
33 ; void func(const int &, const int&);
34 ; int cond();
35 ; void f() {
36 ; while (cond()) {
37 ; int x;
38 ; func(x, 0);
39 ; while (cond()) {
40 ; char y;
41 ; func(&y);
42 ; char j;
43 ; func(&j);
44 ; char I;
45 ; func(&I);
46 ; func(0, 0);
47 ; A g;
48 ; g.m1 = &x;
49 ; f2(g);
50 ; }
51 ; }
52 ; }
53 ; ModuleID = 'test.cpp'
54 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
55 target triple = "spir64-unknown-unknown"
56
57 %struct.A = type { i32*, i32 }
58
59 ; Function Attrs: alwaysinline ssp uwtable
60 define void @_Z2f21A(i32* %p5.coerce0, i32 %p5.coerce1) #0 !dbg !11 {
61 entry:
62 tail call void @llvm.dbg.value(metadata i32* %p5.coerce0, metadata !16, metadata !33), !dbg !34
63 tail call void @llvm.dbg.value(metadata i32 %p5.coerce1, metadata !16, metadata !35), !dbg !34
64 tail call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !16, metadata !36), !dbg !34
65 tail call void @_Z2f1Pii(i32* %p5.coerce0, i32 %p5.coerce1), !dbg !37
66 ret void, !dbg !38
67 }
68
69 ; Function Attrs: nounwind readnone
70 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
71
72 declare void @_Z2f1Pii(i32*, i32) #2
73
74 ; Function Attrs: ssp uwtable
75 define void @_Z1fv() #3 !dbg !17 {
76 entry:
77 %x = alloca i32, align 4
78 %ref.tmp = alloca i32, align 4
79 %y = alloca i8, align 1
80 %j = alloca i8, align 1
81 %I = alloca i8, align 1
82 %ref.tmp5 = alloca i32, align 4
83 %ref.tmp6 = alloca i32, align 4
84 %call11 = call i32 @_Z4condv(), !dbg !39
85 %tobool12 = icmp eq i32 %call11, 0, !dbg !39
86 br i1 %tobool12, label %while.end7, label %while.body, !dbg !40
87
88 while.cond.loopexit: ; preds = %while.body4, %while.body
89 %call = call i32 @_Z4condv(), !dbg !39
90 %tobool = icmp eq i32 %call, 0, !dbg !39
91 br i1 %tobool, label %while.end7, label %while.body, !dbg !40
92
93 while.body: ; preds = %entry, %while.cond.loopexit
94 store i32 0, i32* %ref.tmp, align 4, !dbg !41, !tbaa !42
95 call void @llvm.dbg.value(metadata i32* %x, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !46
96 call void @_Z4funcRKiS0_(i32* dereferenceable(4) %x, i32* dereferenceable(4) %ref.tmp), !dbg !47
97 %call29 = call i32 @_Z4condv(), !dbg !48
98 %tobool310 = icmp eq i32 %call29, 0, !dbg !48
99 br i1 %tobool310, label %while.cond.loopexit, label %while.body4, !dbg !49
100
101 while.body4: ; preds = %while.body, %while.body4
102 call void @llvm.dbg.value(metadata i8* %y, metadata !23, metadata !DIExpression(DW_OP_deref)), !dbg !50
103 call void @_Z4funcPv(i8* %y), !dbg !51
104 call void @llvm.dbg.value(metadata i8* %j, metadata !26, metadata !DIExpression(DW_OP_deref)), !dbg !52
105 call void @_Z4funcPv(i8* %j), !dbg !53
106 call void @llvm.dbg.value(metadata i8* %I, metadata !27, metadata !DIExpression(DW_OP_deref)), !dbg !54
107 call void @_Z4funcPv(i8* %I), !dbg !55
108 store i32 0, i32* %ref.tmp5, align 4, !dbg !56, !tbaa !42
109 store i32 0, i32* %ref.tmp6, align 4, !dbg !57, !tbaa !42
110 call void @_Z4funcRKiS0_(i32* dereferenceable(4) %ref.tmp5, i32* dereferenceable(4) %ref.tmp6), !dbg !58
111 call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !28, metadata !36), !dbg !59
112 call void @llvm.dbg.value(metadata i32* %x, metadata !28, metadata !33), !dbg !59
113 call void @llvm.dbg.value(metadata i32* %x, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !46
114 call void @llvm.dbg.value(metadata i32* %x, metadata !60, metadata !33), !dbg !62
115 call void @llvm.dbg.value(metadata i32 undef, metadata !60, metadata !35), !dbg !62
116 call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !60, metadata !36), !dbg !62
117 call void @_Z2f1Pii(i32* %x, i32 undef), !dbg !63
118 %call2 = call i32 @_Z4condv(), !dbg !48
119 %tobool3 = icmp eq i32 %call2, 0, !dbg !48
120 br i1 %tobool3, label %while.cond.loopexit, label %while.body4, !dbg !49
121
122 while.end7: ; preds = %while.cond.loopexit, %entry
123 ret void, !dbg !64
124 }
125
126 declare i32 @_Z4condv()
127
128 declare void @_Z4funcRKiS0_(i32* dereferenceable(4), i32* dereferenceable(4))
129
130 declare void @_Z4funcPv(i8*)
131
132 ; Function Attrs: nounwind readnone
133 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
134
135 attributes #0 = { alwaysinline ssp uwtable }
136 attributes #1 = { nounwind readnone }
137 attributes #3 = { ssp uwtable }
138
139 !llvm.dbg.cu = !{!0}
140 !llvm.module.flags = !{!29, !30, !31}
141 !llvm.ident = !{!32}
142
143 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.7.0 (trunk 227088) (llvm/trunk 227091)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
144 !1 = !DIFile(filename: "test.cpp", directory: "")
145 !2 = !{}
146 !3 = !{!4}
147 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 128, align: 64, file: !1, elements: !5, identifier: "_ZTS1A")
148 !5 = !{!6, !9}
149 !6 = !DIDerivedType(tag: DW_TAG_member, name: "m1", line: 2, size: 64, align: 64, file: !1, scope: !4, baseType: !7)
150 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
151 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
152 !9 = !DIDerivedType(tag: DW_TAG_member, name: "m2", line: 3, size: 32, align: 32, offset: 64, file: !1, scope: !4, baseType: !8)
153 !11 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f21A", line: 7, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 7, file: !1, scope: !12, type: !13, retainedNodes: !15)
154 !12 = !DIFile(filename: "test.cpp", directory: "")
155 !13 = !DISubroutineType(types: !14)
156 !14 = !{null, !4}
157 !15 = !{!16}
158 !16 = !DILocalVariable(name: "p5", line: 7, arg: 1, scope: !11, file: !12, type: !4)
159 !17 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", line: 12, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 12, file: !1, scope: !12, type: !18, retainedNodes: !20)
160 !18 = !DISubroutineType(types: !19)
161 !19 = !{null}
162 !20 = !{!21, !23, !26, !27, !28}
163 !21 = !DILocalVariable(name: "x", line: 14, scope: !22, file: !12, type: !8)
164 !22 = distinct !DILexicalBlock(line: 13, column: 18, file: !1, scope: !17)
165 !23 = !DILocalVariable(name: "y", line: 17, scope: !24, file: !12, type: !25)
166 !24 = distinct !DILexicalBlock(line: 16, column: 20, file: !1, scope: !22)
167 !25 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
168 !26 = !DILocalVariable(name: "j", line: 19, scope: !24, file: !12, type: !25)
169 !27 = !DILocalVariable(name: "I", line: 21, scope: !24, file: !12, type: !25)
170 !28 = !DILocalVariable(name: "g", line: 24, scope: !24, file: !12, type: !4)
171 !29 = !{i32 2, !"Dwarf Version", i32 2}
172 !30 = !{i32 2, !"Debug Info Version", i32 3}
173 !31 = !{i32 1, !"PIC Level", i32 2}
174 !32 = !{!"clang version 3.7.0 (trunk 227088) (llvm/trunk 227091)"}
175 !33 = !DIExpression(DW_OP_LLVM_fragment, 0, 8)
176 !34 = !DILocation(line: 7, column: 42, scope: !11)
177 !35 = !DIExpression(DW_OP_LLVM_fragment, 8, 4)
178 !36 = !DIExpression()
179 !37 = !DILocation(line: 7, column: 48, scope: !11)
180 !38 = !DILocation(line: 7, column: 66, scope: !11)
181 !39 = !DILocation(line: 13, column: 10, scope: !17)
182 !40 = !DILocation(line: 13, column: 3, scope: !17)
183 !41 = !DILocation(line: 15, column: 13, scope: !22)
184 !42 = !{!43, !43, i64 0}
185 !43 = !{!"int", !44, i64 0}
186 !44 = !{!"omnipotent char", !45, i64 0}
187 !45 = !{!"Simple C/C++ TBAA"}
188 !46 = !DILocation(line: 14, column: 9, scope: !22)
189 !47 = !DILocation(line: 15, column: 5, scope: !22)
190 !48 = !DILocation(line: 16, column: 12, scope: !22)
191 !49 = !DILocation(line: 16, column: 5, scope: !22)
192 !50 = !DILocation(line: 17, column: 12, scope: !24)
193 !51 = !DILocation(line: 18, column: 7, scope: !24)
194 !52 = !DILocation(line: 19, column: 12, scope: !24)
195 !53 = !DILocation(line: 20, column: 7, scope: !24)
196 !54 = !DILocation(line: 21, column: 12, scope: !24)
197 !55 = !DILocation(line: 22, column: 7, scope: !24)
198 !56 = !DILocation(line: 23, column: 12, scope: !24)
199 !57 = !DILocation(line: 23, column: 15, scope: !24)
200 !58 = !DILocation(line: 23, column: 7, scope: !24)
201 !59 = !DILocation(line: 24, column: 9, scope: !24)
202 !60 = !DILocalVariable(name: "p5", line: 7, arg: 1, scope: !11, file: !12, type: !4)
203 !61 = distinct !DILocation(line: 26, column: 7, scope: !24)
204 !62 = !DILocation(line: 7, column: 42, scope: !11, inlinedAt: !61)
205 !63 = !DILocation(line: 7, column: 48, scope: !11, inlinedAt: !61)
206 !64 = !DILocation(line: 29, column: 1, scope: !17)