299 lines · plain
1; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=ASM2; RUN: llc -mtriple=x86_64-windows-msvc < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ3 4; This LL file was generated by running 'clang -g -gcodeview' on the5; 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: # @f25; ASM: .cv_func_id 026; ASM: .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"27; ASM: .cv_loc 0 1 7 0 # t.cpp:7:028; ASM: .seh_proc f29; ASM: # %bb.0: # %entry30; ASM: subq $56, %rsp31; ASM: movl %ecx, 52(%rsp)32; ASM: [[prologue_end:\.Ltmp.*]]:33; ASM: .cv_loc 0 1 8 7 # t.cpp:8:734; ASM: testl %ecx, %ecx35; ASM: je .LBB0_236; ASM: # %bb.1: # %if.then37; ASM: [[if_start:\.Ltmp.*]]:38; ASM: .cv_loc 0 1 9 9 # t.cpp:9:939; ASM: movl $42, 40(%rsp)40; ASM: [[inline_site1:\.Ltmp.*]]:41; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 10 542; ASM: .cv_loc 1 1 4 7 # t.cpp:4:743; ASM: movl $3, 44(%rsp)44; ASM: leaq 44(%rsp), %rcx45; ASM: .cv_loc 1 1 5 3 # t.cpp:5:346; ASM: callq capture47; ASM: leaq 40(%rsp), %rcx48; ASM: [[end_inline_1:\.Ltmp.*]]:49; ASM: .cv_loc 0 1 11 5 # t.cpp:11:550; ASM: jmp .LBB0_351; ASM: [[else_start:\.Ltmp.*]]:52; ASM: .LBB0_2: # %if.else53; ASM: .cv_loc 0 1 13 9 # t.cpp:13:954; ASM: movl $42, 36(%rsp)55; ASM: [[inline_site2:\.Ltmp.*]]:56; ASM: .cv_inline_site_id 2 within 0 inlined_at 1 14 557; ASM: .cv_loc 2 1 4 7 # t.cpp:4:758; ASM: movl $3, 48(%rsp)59; ASM: leaq 48(%rsp), %rcx60; ASM: .cv_loc 2 1 5 3 # t.cpp:5:361; ASM: callq capture62; ASM: leaq 36(%rsp), %rcx63; ASM: [[else_end:\.Ltmp.*]]:64; ASM: .LBB0_3: # %if.end65; ASM: .cv_loc 0 1 17 1 # t.cpp:17:166; ASM: callq capture67; ASM: nop68; ASM: addq $56, %rsp69; ASM: retq70; ASM: [[param_end:\.Ltmp.*]]:71 72; ASM: .short 4414 # Record kind: S_LOCAL73; ASM: .long 116 # TypeIndex74; ASM: .short 1 # Flags75; ASM: .asciz "param"76; ASM: .cv_def_range [[prologue_end]] [[param_end]], frame_ptr_rel, 5277; ASM: .short 4414 # Record kind: S_LOCAL78; ASM: .long 116 # TypeIndex79; ASM: .short 0 # Flags80; ASM: .asciz "a"81; ASM: .cv_def_range [[if_start]] [[else_start]], frame_ptr_rel, 4082; ASM: .short 4414 # Record kind: S_LOCAL83; ASM: .long 116 # TypeIndex84; ASM: .short 0 # Flags85; ASM: .asciz "b"86; ASM: .cv_def_range [[else_start]] [[else_end]], frame_ptr_rel, 3687; ASM: .short 4429 # Record kind: S_INLINESITE88; ASM: .short 4414 # Record kind: S_LOCAL89; ASM: .long 116 # TypeIndex90; ASM: .short 0 # Flags91; ASM: .asciz "v"92; ASM: .cv_def_range [[inline_site1]] [[end_inline_1]], frame_ptr_rel, 4493; ASM: .short 4430 # Record kind: S_INLINESITE_END94; ASM: .short 4429 # Record kind: S_INLINESITE95; ASM: .short 4414 # Record kind: S_LOCAL96; ASM: .long 116 # TypeIndex97; ASM: .short 0 # Flags98; ASM: .asciz "v"99; ASM: .cv_def_range [[inline_site2]] [[else_end]], frame_ptr_rel, 48100; ASM: .short 4430 # Record kind: S_INLINESITE_END101 102; OBJ: Subsection [103; OBJ: SubSectionType: Symbols (0xF1)104; OBJ: {{.*}}Proc{{.*}}Sym {105; OBJ: DisplayName: f106; OBJ: LinkageName: f107; OBJ: }108; OBJ: LocalSym {109; OBJ: Type: int (0x74)110; OBJ: Flags [ (0x1)111; OBJ: IsParameter (0x1)112; OBJ: ]113; OBJ: VarName: param114; OBJ: }115; OBJ: DefRangeFramePointerRelSym {116; OBJ: Offset: 52117; OBJ: LocalVariableAddrRange {118; OBJ: OffsetStart: .text+0x8119; OBJ: ISectStart: 0x0120; OBJ: Range: 0x4F121; OBJ: }122; OBJ: }123; OBJ: LocalSym {124; OBJ: Type: int (0x74)125; OBJ: Flags [ (0x0)126; OBJ: ]127; OBJ: VarName: a128; OBJ: }129; OBJ: DefRangeFramePointerRelSym {130; OBJ: Offset: 40131; OBJ: LocalVariableAddrRange {132; OBJ: OffsetStart: .text+0xC133; OBJ: ISectStart: 0x0134; OBJ: Range: 0x21135; OBJ: }136; OBJ: }137; OBJ: LocalSym {138; OBJ: Type: int (0x74)139; OBJ: Flags [ (0x0)140; OBJ: ]141; OBJ: VarName: b142; OBJ: }143; OBJ: DefRangeFramePointerRelSym {144; OBJ: Offset: 36145; OBJ: LocalVariableAddrRange {146; OBJ: OffsetStart: .text+0x2D147; OBJ: ISectStart: 0x0148; OBJ: Range: 0x1F149; OBJ: }150; OBJ: }151; OBJ: InlineSiteSym {152; OBJ: PtrParent: 0x0153; OBJ: PtrEnd: 0x0154; OBJ: Inlinee: will_be_inlined (0x1002)155; OBJ: BinaryAnnotations [156; OBJ: ChangeLineOffset: 1157; OBJ: ChangeCodeOffset: 0x14158; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}159; OBJ: ChangeCodeLength: 0xA160; OBJ: ]161; OBJ: }162; OBJ: LocalSym {163; OBJ: Type: int (0x74)164; OBJ: Flags [ (0x0)165; OBJ: ]166; OBJ: VarName: v167; OBJ: }168; OBJ: DefRangeFramePointerRelSym {169; OBJ: Offset: 44170; OBJ: LocalVariableAddrRange {171; OBJ: OffsetStart: .text+0x14172; OBJ: ISectStart: 0x0173; OBJ: Range: 0x17174; OBJ: }175; OBJ: }176; OBJ: InlineSiteEnd {177; OBJ: }178; OBJ: InlineSiteSym {179; OBJ: PtrParent: 0x0180; OBJ: PtrEnd: 0x0181; OBJ: Inlinee: will_be_inlined (0x1002)182; OBJ: BinaryAnnotations [183; OBJ: ChangeLineOffset: 1184; OBJ: ChangeCodeOffset: 0x35185; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}186; OBJ: ChangeCodeLength: 0xA187; OBJ: ]188; OBJ: }189; OBJ: LocalSym {190; OBJ: Type: int (0x74)191; OBJ: Flags [ (0x0)192; OBJ: ]193; OBJ: VarName: v194; OBJ: }195; OBJ: DefRangeFramePointerRelSym {196; OBJ: Offset: 48197; OBJ: LocalVariableAddrRange {198; OBJ: OffsetStart: .text+0x35199; OBJ: ISectStart: 0x0200; OBJ: Range: 0x17201; OBJ: }202; OBJ: }203; OBJ: InlineSiteEnd {204; OBJ: }205; OBJ: ProcEnd206; OBJ: ]207 208; ModuleID = 't.cpp'209target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"210target triple = "x86_64-pc-windows-msvc18.0.0"211 212; Function Attrs: nounwind uwtable213define void @f(i32 %param) #0 !dbg !4 {214entry:215 %v.i1 = alloca i32, align 4216 call void @llvm.dbg.declare(metadata ptr %v.i1, metadata !15, metadata !16), !dbg !17217 %v.i = alloca i32, align 4218 call void @llvm.dbg.declare(metadata ptr %v.i, metadata !15, metadata !16), !dbg !21219 %param.addr = alloca i32, align 4220 %a = alloca i32, align 4221 %b = alloca i32, align 4222 store i32 %param, ptr %param.addr, align 4223 call void @llvm.dbg.declare(metadata ptr %param.addr, metadata !24, metadata !16), !dbg !25224 %0 = load i32, ptr %param.addr, align 4, !dbg !26225 %tobool = icmp ne i32 %0, 0, !dbg !26226 br i1 %tobool, label %if.then, label %if.else, !dbg !27227 228if.then: ; preds = %entry229 call void @llvm.dbg.declare(metadata ptr %a, metadata !28, metadata !16), !dbg !29230 store i32 42, ptr %a, align 4, !dbg !29231 store i32 3, ptr %v.i, align 4, !dbg !21232 call void @capture(ptr %v.i) #3, !dbg !30233 call void @capture(ptr %a), !dbg !31234 br label %if.end, !dbg !32235 236if.else: ; preds = %entry237 call void @llvm.dbg.declare(metadata ptr %b, metadata !33, metadata !16), !dbg !34238 store i32 42, ptr %b, align 4, !dbg !34239 store i32 3, ptr %v.i1, align 4, !dbg !17240 call void @capture(ptr %v.i1) #3, !dbg !35241 call void @capture(ptr %b), !dbg !36242 br label %if.end243 244if.end: ; preds = %if.else, %if.then245 ret void, !dbg !37246}247 248; Function Attrs: nounwind readnone249declare void @llvm.dbg.declare(metadata, metadata, metadata) #1250 251declare void @capture(ptr) #2252 253attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" "use-soft-float"="false" }254attributes #1 = { nounwind readnone }255attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" "use-soft-float"="false" }256attributes #3 = { nounwind }257 258!llvm.dbg.cu = !{!0}259!llvm.module.flags = !{!11, !12, !13}260!llvm.ident = !{!14}261 262!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)263!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")264!2 = !{}265!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)266!5 = !DISubroutineType(types: !6)267!6 = !{null, !7}268!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)269!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)270!9 = !DISubroutineType(types: !10)271!10 = !{null}272!11 = !{i32 2, !"CodeView", i32 1}273!12 = !{i32 2, !"Debug Info Version", i32 3}274!13 = !{i32 1, !"PIC Level", i32 2}275!14 = !{!"clang version 3.9.0 "}276!15 = !DILocalVariable(name: "v", scope: !8, file: !1, line: 4, type: !7)277!16 = !DIExpression()278!17 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !18)279!18 = distinct !DILocation(line: 14, column: 5, scope: !19)280!19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 12, column: 10)281!20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 8, column: 7)282!21 = !DILocation(line: 4, column: 7, scope: !8, inlinedAt: !22)283!22 = distinct !DILocation(line: 10, column: 5, scope: !23)284!23 = distinct !DILexicalBlock(scope: !20, file: !1, line: 8, column: 14)285!24 = !DILocalVariable(name: "param", arg: 1, scope: !4, file: !1, line: 7, type: !7)286!25 = !DILocation(line: 7, column: 23, scope: !4)287!26 = !DILocation(line: 8, column: 7, scope: !20)288!27 = !DILocation(line: 8, column: 7, scope: !4)289!28 = !DILocalVariable(name: "a", scope: !23, file: !1, line: 9, type: !7)290!29 = !DILocation(line: 9, column: 9, scope: !23)291!30 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !22)292!31 = !DILocation(line: 11, column: 5, scope: !23)293!32 = !DILocation(line: 12, column: 3, scope: !23)294!33 = !DILocalVariable(name: "b", scope: !19, file: !1, line: 13, type: !7)295!34 = !DILocation(line: 13, column: 9, scope: !19)296!35 = !DILocation(line: 5, column: 3, scope: !8, inlinedAt: !18)297!36 = !DILocation(line: 15, column: 5, scope: !19)298!37 = !DILocation(line: 17, column: 1, scope: !4)299