1; RUN: llc < %s -filetype=obj -arm-atomic-cfg-tidy=0 | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ 2 3; Generated from: 4 5; volatile int x; 6; int getint(void); 7; void putint(int); 8; static inline int inlineinc(int a) { 9; int b = a + 1; 10; ++x; 11; return b; 12; } 13; void f(int p) { 14; if (p) { 15; int a = getint(); 16; int b = inlineinc(a); 17; putint(b); 18; } else { 19; int c = getint(); 20; putint(c); 21; } 22; } 23 24; OBJ: Compile3Sym { 25; OBJ-NEXT: Kind: S_COMPILE3 (0x113C) 26; OBJ-NEXT: Language: C (0x0) 27; OBJ-NEXT: Flags [ (0x4000) 28; OBJ-NEXT: HotPatch (0x4000) 29; OBJ-NEXT: ] 30; OBJ-NEXT: Machine: ARMNT (0xF4) 31 32; OBJ: LocalSym { 33; OBJ-NEXT: Kind: S_LOCAL (0x113E) 34; OBJ-NEXT: Type: int (0x74) 35; OBJ-NEXT: Flags [ (0x1) 36; OBJ-NEXT: IsParameter (0x1) 37; OBJ-NEXT: ] 38; OBJ-NEXT: VarName: p 39; OBJ-NEXT: } 40; OBJ-NEXT: DefRangeRegisterRelSym { 41; OBJ-NEXT: Kind: S_DEFRANGE_REGISTER_REL (0x1145) 42; OBJ-NEXT: BaseRegister: ARM_SP (0x17) 43; OBJ-NEXT: HasSpilledUDTMember: No 44; OBJ-NEXT: OffsetInParent: 0 45; OBJ-NEXT: BasePointerOffset: 12 46; OBJ-NEXT: LocalVariableAddrRange { 47; OBJ-NEXT: OffsetStart: .text+0x8 48; OBJ-NEXT: ISectStart: 0x0 49; OBJ-NEXT: Range: 0x1A 50; OBJ-NEXT: } 51; OBJ-NEXT: } 52 53; ModuleID = 'test.c' 54source_filename = "test.c" 55target datalayout = "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 56target triple = "thumbv7-pc-windows-msvc19.11.0" 57 58@x = dso_local global i32 0, align 4, !dbg !0 59 60define dso_local arm_aapcs_vfpcc void @f(i32 %p) !dbg !14 { 61entry: 62 %p.addr = alloca i32, align 4 63 %a = alloca i32, align 4 64 %b = alloca i32, align 4 65 %c = alloca i32, align 4 66 store i32 %p, ptr %p.addr, align 4 67 #dbg_declare(ptr %p.addr, !17, !DIExpression(), !18) 68 %0 = load i32, ptr %p.addr, align 4, !dbg !19 69 %tobool = icmp ne i32 %0, 0, !dbg !19 70 %call = call arm_aapcs_vfpcc i32 @getint(), !dbg !20 71 br i1 %tobool, label %if.then, label %if.else, !dbg !19 72 73if.then: ; preds = %entry 74 #dbg_declare(ptr %a, !22, !DIExpression(), !24) 75 store i32 %call, ptr %a, align 4, !dbg !24 76 #dbg_declare(ptr %b, !25, !DIExpression(), !26) 77 %1 = load i32, ptr %a, align 4, !dbg !26 78 %call1 = call arm_aapcs_vfpcc i32 @inlineinc(i32 %1), !dbg !26 79 store i32 %call1, ptr %b, align 4, !dbg !26 80 %2 = load i32, ptr %b, align 4, !dbg !27 81 br label %if.end, !dbg !28 82 83if.else: ; preds = %entry 84 #dbg_declare(ptr %c, !29, !DIExpression(), !31) 85 store i32 %call, ptr %c, align 4, !dbg !31 86 %3 = load i32, ptr %c, align 4, !dbg !32 87 br label %if.end, !dbg !33 88 89if.end: ; preds = %if.else, %if.then 90 %.sink = phi i32 [ %3, %if.else ], [ %2, %if.then ] 91 call arm_aapcs_vfpcc void @putint(i32 %.sink), !dbg !20 92 ret void, !dbg !34 93} 94 95declare dso_local arm_aapcs_vfpcc i32 @getint() 96 97define internal arm_aapcs_vfpcc i32 @inlineinc(i32 %a) !dbg !35 { 98entry: 99 %a.addr = alloca i32, align 4 100 %b = alloca i32, align 4 101 store i32 %a, ptr %a.addr, align 4 102 #dbg_declare(ptr %a.addr, !38, !DIExpression(), !39) 103 #dbg_declare(ptr %b, !40, !DIExpression(), !41) 104 %0 = load i32, ptr %a.addr, align 4, !dbg !41 105 %add = add nsw i32 %0, 1, !dbg !41 106 store i32 %add, ptr %b, align 4, !dbg !41 107 %1 = load volatile i32, ptr @x, align 4, !dbg !42 108 %inc = add nsw i32 %1, 1, !dbg !42 109 store volatile i32 %inc, ptr @x, align 4, !dbg !42 110 %2 = load i32, ptr %b, align 4, !dbg !43 111 ret i32 %2, !dbg !43 112} 113 114declare dso_local arm_aapcs_vfpcc void @putint(i32) 115 116!llvm.dbg.cu = !{!2} 117!llvm.module.flags = !{!9, !10, !11, !12} 118!llvm.ident = !{!13} 119 120!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 121!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !6, line: 1, type: !7, isLocal: false, isDefinition: true) 122!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git fc031d29bea856f2b91a250fd81c5f9fb79dbe07)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None) 123!3 = !DIFile(filename: "F:\\tmp\\test.c", directory: "F:\\tmp", checksumkind: CSK_MD5, checksum: "5fbd15e58dd6931fc3081de308d52889") 124!4 = !{} 125!5 = !{!0} 126!6 = !DIFile(filename: "test.c", directory: "F:\\tmp", checksumkind: CSK_MD5, checksum: "5fbd15e58dd6931fc3081de308d52889") 127!7 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !8) 128!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 129!9 = !{i32 2, !"CodeView", i32 1} 130!10 = !{i32 2, !"Debug Info Version", i32 3} 131!11 = !{i32 1, !"wchar_size", i32 2} 132!12 = !{i32 1, !"min_enum_size", i32 4} 133!13 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git fc031d29bea856f2b91a250fd81c5f9fb79dbe07)"} 134!14 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 9, type: !15, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) 135!15 = !DISubroutineType(types: !16) 136!16 = !{null, !8} 137!17 = !DILocalVariable(name: "p", arg: 1, scope: !14, file: !6, line: 9, type: !8) 138!18 = !DILocation(line: 9, scope: !14) 139!19 = !DILocation(line: 10, scope: !14) 140!20 = !DILocation(line: 0, scope: !21) 141!21 = distinct !DILexicalBlock(scope: !14, file: !6, line: 10) 142!22 = !DILocalVariable(name: "a", scope: !23, file: !6, line: 11, type: !8) 143!23 = distinct !DILexicalBlock(scope: !21, file: !6, line: 10) 144!24 = !DILocation(line: 11, scope: !23) 145!25 = !DILocalVariable(name: "b", scope: !23, file: !6, line: 12, type: !8) 146!26 = !DILocation(line: 12, scope: !23) 147!27 = !DILocation(line: 13, scope: !23) 148!28 = !DILocation(line: 14, scope: !23) 149!29 = !DILocalVariable(name: "c", scope: !30, file: !6, line: 15, type: !8) 150!30 = distinct !DILexicalBlock(scope: !21, file: !6, line: 14) 151!31 = !DILocation(line: 15, scope: !30) 152!32 = !DILocation(line: 16, scope: !30) 153!33 = !DILocation(line: 17, scope: !30) 154!34 = !DILocation(line: 18, scope: !14) 155!35 = distinct !DISubprogram(name: "inlineinc", scope: !6, file: !6, line: 4, type: !36, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4) 156!36 = !DISubroutineType(types: !37) 157!37 = !{!8, !8} 158!38 = !DILocalVariable(name: "a", arg: 1, scope: !35, file: !6, line: 4, type: !8) 159!39 = !DILocation(line: 4, scope: !35) 160!40 = !DILocalVariable(name: "b", scope: !35, file: !6, line: 5, type: !8) 161!41 = !DILocation(line: 5, scope: !35) 162!42 = !DILocation(line: 6, scope: !35) 163!43 = !DILocation(line: 7, scope: !35) 164