1 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=ASM
2 ; RUN: llc -mtriple=x86_64-windows-msvc < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
4 ; This LL file was generated by running 'clang -g -gcodeview' on the
6 ; 1: extern "C" volatile int x;
7 ; 2: extern "C" void capture(int *p);
8 ; 3: static __forceinline inline void will_be_inlined() {
12 ; 7: extern "C" void f(int param) {
15 ; 10: will_be_inlined();
19 ; 14: will_be_inlined();
26 ; ASM: .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
27 ; ASM: .cv_loc 0 1 7 0 # t.cpp:7:0
29 ; ASM: # %bb.0: # %entry
31 ; ASM: movl %ecx, 52(%rsp)
32 ; ASM: [[prologue_end:\.Ltmp.*]]:
33 ; ASM: .cv_loc 0 1 8 7 # t.cpp:8:7
34 ; ASM: testl %ecx, %ecx
36 ; ASM: # %bb.1: # %if.then
37 ; ASM: [[if_start:\.Ltmp.*]]:
38 ; ASM: .cv_loc 0 1 9 9 # t.cpp:9:9
39 ; ASM: movl $42, 40(%rsp)
40 ; ASM: [[inline_site1:\.Ltmp.*]]:
41 ; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 10 5
42 ; ASM: .cv_loc 1 1 4 7 # t.cpp:4:7
43 ; ASM: movl $3, 44(%rsp)
44 ; ASM: leaq 44(%rsp), %rcx
45 ; ASM: .cv_loc 1 1 5 3 # t.cpp:5:3
47 ; ASM: leaq 40(%rsp), %rcx
49 ; ASM: [[else_start:\.Ltmp.*]]:
50 ; ASM: .LBB0_2: # %if.else
51 ; ASM: .cv_loc 0 1 13 9 # t.cpp:13:9
52 ; ASM: movl $42, 36(%rsp)
53 ; ASM: [[inline_site2:\.Ltmp.*]]:
54 ; ASM: .cv_inline_site_id 2 within 0 inlined_at 1 14 5
55 ; ASM: .cv_loc 2 1 4 7 # t.cpp:4:7
56 ; ASM: movl $3, 48(%rsp)
57 ; ASM: leaq 48(%rsp), %rcx
58 ; ASM: .cv_loc 2 1 5 3 # t.cpp:5:3
60 ; ASM: leaq 36(%rsp), %rcx
61 ; ASM: [[else_end:\.Ltmp.*]]:
62 ; ASM: .LBB0_3: # %if.end
63 ; ASM: .cv_loc 0 1 0 0 # t.cpp:0:0
68 ; ASM: [[param_end:\.Ltmp.*]]:
70 ; ASM: .short 4414 # Record kind: S_LOCAL
71 ; ASM: .long 116 # TypeIndex
72 ; ASM: .short 1 # Flags
74 ; ASM: .cv_def_range [[prologue_end]] [[param_end]], frame_ptr_rel, 52
75 ; ASM: .short 4414 # Record kind: S_LOCAL
76 ; ASM: .long 116 # TypeIndex
77 ; ASM: .short 0 # Flags
79 ; ASM: .cv_def_range [[if_start]] [[else_start]], frame_ptr_rel, 40
80 ; ASM: .short 4414 # Record kind: S_LOCAL
81 ; ASM: .long 116 # TypeIndex
82 ; ASM: .short 0 # Flags
84 ; ASM: .cv_def_range [[else_start]] [[else_end]], frame_ptr_rel, 36
85 ; ASM: .short 4429 # Record kind: S_INLINESITE
86 ; ASM: .short 4414 # Record kind: S_LOCAL
87 ; ASM: .long 116 # TypeIndex
88 ; ASM: .short 0 # Flags
90 ; ASM: .cv_def_range [[inline_site1]] [[else_start]], frame_ptr_rel, 44
91 ; ASM: .short 4430 # Record kind: S_INLINESITE_END
92 ; ASM: .short 4429 # Record kind: S_INLINESITE
93 ; ASM: .short 4414 # Record kind: S_LOCAL
94 ; ASM: .long 116 # TypeIndex
95 ; ASM: .short 0 # Flags
97 ; ASM: .cv_def_range [[inline_site2]] [[else_end]], frame_ptr_rel, 48
98 ; ASM: .short 4430 # Record kind: S_INLINESITE_END
101 ; OBJ: SubSectionType: Symbols (0xF1)
102 ; OBJ: {{.*}}Proc{{.*}}Sym {
103 ; OBJ: DisplayName: f
104 ; OBJ: LinkageName: f
107 ; OBJ: Type: int (0x74)
109 ; OBJ: IsParameter (0x1)
111 ; OBJ: VarName: param
113 ; OBJ: DefRangeFramePointerRelSym {
115 ; OBJ: LocalVariableAddrRange {
116 ; OBJ: OffsetStart: .text+0x8
117 ; OBJ: ISectStart: 0x0
122 ; OBJ: Type: int (0x74)
127 ; OBJ: DefRangeFramePointerRelSym {
129 ; OBJ: LocalVariableAddrRange {
130 ; OBJ: OffsetStart: .text+0xC
131 ; OBJ: ISectStart: 0x0
136 ; OBJ: Type: int (0x74)
141 ; OBJ: DefRangeFramePointerRelSym {
143 ; OBJ: LocalVariableAddrRange {
144 ; OBJ: OffsetStart: .text+0x2D
145 ; OBJ: ISectStart: 0x0
149 ; OBJ: InlineSiteSym {
150 ; OBJ: PtrParent: 0x0
152 ; OBJ: Inlinee: will_be_inlined (0x1002)
153 ; OBJ: BinaryAnnotations [
154 ; OBJ: ChangeLineOffset: 1
155 ; OBJ: ChangeCodeOffset: 0x14
156 ; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
157 ; OBJ: ChangeCodeLength: 0xC
161 ; OBJ: Type: int (0x74)
166 ; OBJ: DefRangeFramePointerRelSym {
168 ; OBJ: LocalVariableAddrRange {
169 ; OBJ: OffsetStart: .text+0x14
170 ; OBJ: ISectStart: 0x0
174 ; OBJ: InlineSiteEnd {
176 ; OBJ: InlineSiteSym {
177 ; OBJ: PtrParent: 0x0
179 ; OBJ: Inlinee: will_be_inlined (0x1002)
180 ; OBJ: BinaryAnnotations [
181 ; OBJ: ChangeLineOffset: 1
182 ; OBJ: ChangeCodeOffset: 0x35
183 ; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
184 ; OBJ: ChangeCodeLength: 0xA
188 ; OBJ: Type: int (0x74)
193 ; OBJ: DefRangeFramePointerRelSym {
195 ; OBJ: LocalVariableAddrRange {
196 ; OBJ: OffsetStart: .text+0x35
197 ; OBJ: ISectStart: 0x0
201 ; OBJ: InlineSiteEnd {
207 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
208 target triple = "x86_64-pc-windows-msvc18.0.0"
210 ; Function Attrs: nounwind uwtable
211 define void @f(i32 %param) #0 !dbg !4 {
213 %v.i1 = alloca i32, align 4
214 call void @llvm.dbg.declare(metadata i32* %v.i1, metadata !15, metadata !16), !dbg !17
215 %v.i = alloca i32, align 4
216 call void @llvm.dbg.declare(metadata i32* %v.i, metadata !15, metadata !16), !dbg !21
217 %param.addr = alloca i32, align 4
218 %a = alloca i32, align 4
219 %b = alloca i32, align 4
220 store i32 %param, i32* %param.addr, align 4
221 call void @llvm.dbg.declare(metadata i32* %param.addr, metadata !24, metadata !16), !dbg !25
222 %0 = load i32, i32* %param.addr, align 4, !dbg !26
223 %tobool = icmp ne i32 %0, 0, !dbg !26
224 br i1 %tobool, label %if.then, label %if.else, !dbg !27
226 if.then: ; preds = %entry
227 call void @llvm.dbg.declare(metadata i32* %a, metadata !28, metadata !16), !dbg !29
228 store i32 42, i32* %a, align 4, !dbg !29
229 store i32 3, i32* %v.i, align 4, !dbg !21
230 call void @capture(i32* %v.i) #3, !dbg !30
231 call void @capture(i32* %a), !dbg !31
232 br label %if.end, !dbg !32
234 if.else: ; preds = %entry
235 call void @llvm.dbg.declare(metadata i32* %b, metadata !33, metadata !16), !dbg !34
236 store i32 42, i32* %b, align 4, !dbg !34
237 store i32 3, i32* %v.i1, align 4, !dbg !17
238 call void @capture(i32* %v.i1) #3, !dbg !35
239 call void @capture(i32* %b), !dbg !36
242 if.end: ; preds = %if.else, %if.then
246 ; Function Attrs: nounwind readnone
247 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
249 declare void @capture(i32*) #2
251 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
252 attributes #1 = { nounwind readnone }
253 attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
254 attributes #3 = { nounwind }
257 !llvm.module.flags = !{!11, !12, !13}
260 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
261 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
263 !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
264 !5 = !DISubroutineType(types: !6)
266 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
267 !8 = distinct !DISubprogram(name: "will_be_inlined", linkageName: "\01?will_be_inlined@@YAXXZ", scope: !1, file: !1, line: 3, type: !9, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
268 !9 = !DISubroutineType(types: !10)
270 !11 = !{i32 2, !"CodeView", i32 1}
271 !12 = !{i32 2, !"Debug Info Version", i32 3}
272 !13 = !{i32 1, !"PIC Level", i32 2}
273 !14 = !{!"clang version 3.9.0 "}
274 !15 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !7)
275 !16 = !DIExpression()
276 !17 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !18)
277 !18 = distinct !DILocation(line: 14, column: 5, scope: !19)
278 !19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 12, column: 10)
279 !20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 8, column: 7)
280 !21 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !22)
281 !22 = distinct !DILocation(line: 10, column: 5, scope: !23)
282 !23 = distinct !DILexicalBlock(scope: !20, file: !1, line: 8, column: 14)
283 !24 = !DILocalVariable(name: "param", arg: 1, scope: !4, file: !1, line: 7, type: !7)
284 !25 = !DILocation(line: 7, column: 23, scope: !4)
285 !26 = !DILocation(line: 8, column: 7, scope: !20)
286 !27 = !DILocation(line: 8, column: 7, scope: !4)
287 !28 = !DILocalVariable(name: "a", scope: !23, file: !1, line: 9, type: !7)
288 !29 = !DILocation(line: 9, column: 9, scope: !23)
289 !30 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !22)
290 !31 = !DILocation(line: 11, column: 5, scope: !23)
291 !32 = !DILocation(line: 12, column: 3, scope: !23)
292 !33 = !DILocalVariable(name: "b", scope: !19, file: !1, line: 13, type: !7)
293 !34 = !DILocation(line: 13, column: 9, scope: !19)
294 !35 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !18)
295 !36 = !DILocation(line: 15, column: 5, scope: !19)
296 !37 = !DILocation(line: 17, column: 1, scope: !4)