• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4; This LL file was generated by running 'clang -g -gcodeview' on the
5; following code:
6;  1: extern "C" volatile int x;
7;  2: extern "C" void capture(int *p);
8;  3: static __forceinline inline void will_be_inlined() {
9;  4:   int v = 3;
10;  5:   capture(&v);
11;  6: }
12;  7: extern "C" void f(int param) {
13;  8:   if (param) {
14;  9:     int a = 42;
15; 10:     will_be_inlined();
16; 11:     capture(&a);
17; 12:   } else {
18; 13:     int b = 42;
19; 14:     will_be_inlined();
20; 15:     capture(&b);
21; 16:   }
22; 17: }
23
24; ASM: f:                                      # @f
25; ASM:         .cv_file        1 "D:\\src\\llvm\\build\\t.cpp"
26; ASM:         .cv_loc 0 1 7 0 is_stmt 0       # t.cpp:7:0
27; ASM: .seh_proc f
28; ASM: # BB#0:                                 # %entry
29; ASM:         subq    $56, %rsp
30; ASM:         #DEBUG_VALUE: f:param <- [%RSP+52]
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
35; ASM:         je      .LBB0_2
36; ASM: [[if_start:\.Ltmp.*]]:
37; ASM: # BB#1:                                 # %if.then
38; ASM:         #DEBUG_VALUE: f:param <- [%RSP+52]
39; ASM:         #DEBUG_VALUE: a <- [%RSP+40]
40; ASM:         .cv_loc 0 1 9 9                 # t.cpp:9:9
41; ASM:         movl    $42, 40(%rsp)
42; ASM: [[inline_site1:\.Ltmp.*]]:
43; ASM:         .cv_loc 1 1 4 7                 # t.cpp:4:7
44; ASM:         movl    $3, 44(%rsp)
45; ASM:         leaq    44(%rsp), %rcx
46; ASM:         .cv_loc 1 1 5 3                 # t.cpp:5:3
47; ASM:         callq   capture
48; ASM:         leaq    40(%rsp), %rcx
49; ASM:         jmp     .LBB0_3
50; ASM: [[else_start:\.Ltmp.*]]:
51; ASM: .LBB0_2:                                # %if.else
52; ASM:         #DEBUG_VALUE: f:param <- [%RSP+52]
53; ASM:         #DEBUG_VALUE: b <- [%RSP+36]
54; ASM:         .cv_loc 0 1 13 9                # t.cpp:13:9
55; ASM:         movl    $42, 36(%rsp)
56; ASM: [[inline_site2:\.Ltmp.*]]:
57; ASM:         .cv_loc 2 1 4 7                 # t.cpp:4:7
58; ASM:         movl    $3, 48(%rsp)
59; ASM:         leaq    48(%rsp), %rcx
60; ASM:         .cv_loc 2 1 5 3                 # t.cpp:5:3
61; ASM:         callq   capture
62; ASM:         leaq    36(%rsp), %rcx
63; ASM: [[inline_site2_end:\.Ltmp.*]]:
64; ASM: .LBB0_3:                                # %if.end
65; ASM:         .cv_loc 0 1 15 5                # t.cpp:15:5
66; ASM:         callq   capture
67; ASM: [[else_end:\.Ltmp.*]]:
68; ASM:         .cv_loc 0 1 17 1                # t.cpp:17:1
69; ASM:         nop
70; ASM:         addq    $56, %rsp
71; ASM:         retq
72; ASM: [[param_end:\.Ltmp.*]]:
73
74; ASM: .short  4414                    # Record kind: S_LOCAL
75; ASM: .long   116                     # TypeIndex
76; ASM: .short  1                       # Flags
77; ASM: .asciz  "param"
78; ASM: .cv_def_range    [[prologue_end]] [[param_end]], "E\021O\001\000\0004\000\000\000"
79; ASM: .short  4414                    # Record kind: S_LOCAL
80; ASM: .long   116                     # TypeIndex
81; ASM: .short  0                       # Flags
82; ASM: .asciz  "a"
83; ASM: .cv_def_range    [[if_start]] [[else_start]], "E\021O\001\000\000(\000\000\000"
84; ASM: .short  4414                    # Record kind: S_LOCAL
85; ASM: .long   116                     # TypeIndex
86; ASM: .short  0                       # Flags
87; ASM: .asciz  "b"
88; ASM: .cv_def_range    [[else_start]] [[else_end]], "E\021O\001\000\000$\000\000\000"
89; ASM: .short  4429                    # Record kind: S_INLINESITE
90; ASM: .short  4414                    # Record kind: S_LOCAL
91; ASM: .long   116                     # TypeIndex
92; ASM: .short  0                       # Flags
93; ASM: .asciz  "v"
94; ASM: .cv_def_range    [[inline_site1]] [[else_start]], "E\021O\001\000\000,\000\000\000"
95; ASM: .short  4430                    # Record kind: S_INLINESITE_END
96; ASM: .short  4429                    # Record kind: S_INLINESITE
97; ASM: .short  4414                    # Record kind: S_LOCAL
98; ASM: .long   116                     # TypeIndex
99; ASM: .short  0                       # Flags
100; ASM: .asciz  "v"
101; ASM: .cv_def_range    [[inline_site2]] [[inline_site2_end]], "E\021O\001\000\0000\000\000\000"
102; ASM: .short  4430                    # Record kind: S_INLINESITE_END
103
104; OBJ:  Subsection [
105; OBJ:    SubSectionType: Symbols (0xF1)
106; OBJ:    ProcStart {
107; OBJ:      DisplayName: f
108; OBJ:      LinkageName: f
109; OBJ:    }
110; OBJ:    Local {
111; OBJ:      Type: int (0x74)
112; OBJ:      Flags [ (0x1)
113; OBJ:        IsParameter (0x1)
114; OBJ:      ]
115; OBJ:      VarName: param
116; OBJ:    }
117; OBJ:    DefRangeRegisterRel {
118; OBJ:      BaseRegister: 335
119; OBJ:      HasSpilledUDTMember: No
120; OBJ:      OffsetInParent: 0
121; OBJ:      BasePointerOffset: 52
122; OBJ:      LocalVariableAddrRange {
123; OBJ:        OffsetStart: .text+0x8
124; OBJ:        ISectStart: 0x0
125; OBJ:        Range: 0x4F
126; OBJ:      }
127; OBJ:    }
128; OBJ:    Local {
129; OBJ:      Type: int (0x74)
130; OBJ:      Flags [ (0x0)
131; OBJ:      ]
132; OBJ:      VarName: a
133; OBJ:    }
134; OBJ:    DefRangeRegisterRel {
135; OBJ:      BaseRegister: 335
136; OBJ:      HasSpilledUDTMember: No
137; OBJ:      OffsetInParent: 0
138; OBJ:      BasePointerOffset: 40
139; OBJ:      LocalVariableAddrRange {
140; OBJ:        OffsetStart: .text+0xC
141; OBJ:        ISectStart: 0x0
142; OBJ:        Range: 0x21
143; OBJ:      }
144; OBJ:    }
145; OBJ:    Local {
146; OBJ:      Type: int (0x74)
147; OBJ:      Flags [ (0x0)
148; OBJ:      ]
149; OBJ:      VarName: b
150; OBJ:    }
151; OBJ:    DefRangeRegisterRel {
152; OBJ:      BaseRegister: 335
153; OBJ:      HasSpilledUDTMember: No
154; OBJ:      OffsetInParent: 0
155; OBJ:      BasePointerOffset: 36
156; OBJ:      LocalVariableAddrRange {
157; OBJ:        OffsetStart: .text+0x2D
158; OBJ:        ISectStart: 0x0
159; OBJ:        Range: 0x24
160; OBJ:      }
161; OBJ:    }
162; OBJ:    InlineSite {
163; OBJ:      PtrParent: 0x0
164; OBJ:      PtrEnd: 0x0
165; OBJ:      Inlinee: will_be_inlined (0x1002)
166; OBJ:      BinaryAnnotations [
167; OBJ:        ChangeLineOffset: 1
168; OBJ:        ChangeCodeOffset: 0x14
169; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
170; OBJ:        ChangeCodeLength: 0xC
171; OBJ:      ]
172; OBJ:    }
173; OBJ:    Local {
174; OBJ:      Type: int (0x74)
175; OBJ:      Flags [ (0x0)
176; OBJ:      ]
177; OBJ:      VarName: v
178; OBJ:    }
179; OBJ:    DefRangeRegisterRel {
180; OBJ:      BaseRegister: 335
181; OBJ:      HasSpilledUDTMember: No
182; OBJ:      OffsetInParent: 0
183; OBJ:      BasePointerOffset: 44
184; OBJ:      LocalVariableAddrRange {
185; OBJ:        OffsetStart: .text+0x14
186; OBJ:        ISectStart: 0x0
187; OBJ:        Range: 0x19
188; OBJ:      }
189; OBJ:    }
190; OBJ:    InlineSiteEnd {
191; OBJ:    }
192; OBJ:    InlineSite {
193; OBJ:      PtrParent: 0x0
194; OBJ:      PtrEnd: 0x0
195; OBJ:      Inlinee: will_be_inlined (0x1002)
196; OBJ:      BinaryAnnotations [
197; OBJ:        ChangeLineOffset: 1
198; OBJ:        ChangeCodeOffset: 0x35
199; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
200; OBJ:        ChangeCodeLength: 0xA
201; OBJ:      ]
202; OBJ:    }
203; OBJ:    Local {
204; OBJ:      Type: int (0x74)
205; OBJ:      Flags [ (0x0)
206; OBJ:      ]
207; OBJ:      VarName: v
208; OBJ:    }
209; OBJ:    DefRangeRegisterRel {
210; OBJ:      BaseRegister: 335
211; OBJ:      HasSpilledUDTMember: No
212; OBJ:      OffsetInParent: 0
213; OBJ:      BasePointerOffset: 48
214; OBJ:      LocalVariableAddrRange {
215; OBJ:        OffsetStart: .text+0x35
216; OBJ:        ISectStart: 0x0
217; OBJ:        Range: 0x17
218; OBJ:      }
219; OBJ:    }
220; OBJ:    InlineSiteEnd {
221; OBJ:    }
222; OBJ:    ProcEnd
223; OBJ:  ]
224
225; ModuleID = 't.cpp'
226target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
227target triple = "x86_64-pc-windows-msvc18.0.0"
228
229; Function Attrs: nounwind uwtable
230define void @f(i32 %param) #0 !dbg !4 {
231entry:
232  %v.i1 = alloca i32, align 4
233  call void @llvm.dbg.declare(metadata i32* %v.i1, metadata !15, metadata !16), !dbg !17
234  %v.i = alloca i32, align 4
235  call void @llvm.dbg.declare(metadata i32* %v.i, metadata !15, metadata !16), !dbg !21
236  %param.addr = alloca i32, align 4
237  %a = alloca i32, align 4
238  %b = alloca i32, align 4
239  store i32 %param, i32* %param.addr, align 4
240  call void @llvm.dbg.declare(metadata i32* %param.addr, metadata !24, metadata !16), !dbg !25
241  %0 = load i32, i32* %param.addr, align 4, !dbg !26
242  %tobool = icmp ne i32 %0, 0, !dbg !26
243  br i1 %tobool, label %if.then, label %if.else, !dbg !27
244
245if.then:                                          ; preds = %entry
246  call void @llvm.dbg.declare(metadata i32* %a, metadata !28, metadata !16), !dbg !29
247  store i32 42, i32* %a, align 4, !dbg !29
248  store i32 3, i32* %v.i, align 4, !dbg !21
249  call void @capture(i32* %v.i) #3, !dbg !30
250  call void @capture(i32* %a), !dbg !31
251  br label %if.end, !dbg !32
252
253if.else:                                          ; preds = %entry
254  call void @llvm.dbg.declare(metadata i32* %b, metadata !33, metadata !16), !dbg !34
255  store i32 42, i32* %b, align 4, !dbg !34
256  store i32 3, i32* %v.i1, align 4, !dbg !17
257  call void @capture(i32* %v.i1) #3, !dbg !35
258  call void @capture(i32* %b), !dbg !36
259  br label %if.end
260
261if.end:                                           ; preds = %if.else, %if.then
262  ret void, !dbg !37
263}
264
265; Function Attrs: nounwind readnone
266declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
267
268declare void @capture(i32*) #2
269
270attributes #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" }
271attributes #1 = { nounwind readnone }
272attributes #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" }
273attributes #3 = { nounwind }
274
275!llvm.dbg.cu = !{!0}
276!llvm.module.flags = !{!11, !12, !13}
277!llvm.ident = !{!14}
278
279!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)
280!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
281!2 = !{}
282!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, variables: !2)
283!5 = !DISubroutineType(types: !6)
284!6 = !{null, !7}
285!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
286!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, variables: !2)
287!9 = !DISubroutineType(types: !10)
288!10 = !{null}
289!11 = !{i32 2, !"CodeView", i32 1}
290!12 = !{i32 2, !"Debug Info Version", i32 3}
291!13 = !{i32 1, !"PIC Level", i32 2}
292!14 = !{!"clang version 3.9.0 "}
293!15 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !7)
294!16 = !DIExpression()
295!17 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !18)
296!18 = distinct !DILocation(line: 14, column: 5, scope: !19)
297!19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 12, column: 10)
298!20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 8, column: 7)
299!21 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !22)
300!22 = distinct !DILocation(line: 10, column: 5, scope: !23)
301!23 = distinct !DILexicalBlock(scope: !20, file: !1, line: 8, column: 14)
302!24 = !DILocalVariable(name: "param", arg: 1, scope: !4, file: !1, line: 7, type: !7)
303!25 = !DILocation(line: 7, column: 23, scope: !4)
304!26 = !DILocation(line: 8, column: 7, scope: !20)
305!27 = !DILocation(line: 8, column: 7, scope: !4)
306!28 = !DILocalVariable(name: "a", scope: !23, file: !1, line: 9, type: !7)
307!29 = !DILocation(line: 9, column: 9, scope: !23)
308!30 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !22)
309!31 = !DILocation(line: 11, column: 5, scope: !23)
310!32 = !DILocation(line: 12, column: 3, scope: !23)
311!33 = !DILocalVariable(name: "b", scope: !19, file: !1, line: 13, type: !7)
312!34 = !DILocation(line: 13, column: 9, scope: !19)
313!35 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !18)
314!36 = !DILocation(line: 15, column: 5, scope: !19)
315!37 = !DILocation(line: 17, column: 1, scope: !4)
316