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