|
| 1 | +# RUN: llc -start-after=livedebugvalues --filetype=obj %s -o - \ |
| 2 | +# RUN: | llvm-dwarfdump -v -name=parama - | FileCheck %s |
| 3 | +# |
| 4 | +# Generated with -O2, llc -stop-after=livedebugvalues, with IR modified from |
| 5 | +# this source: |
| 6 | +# |
| 7 | +# int globa, globb; |
| 8 | +# void ext(); |
| 9 | +# static void set(int parama, int paramb) { |
| 10 | +# globa = parama; |
| 11 | +# globb = paramb; |
| 12 | +# } |
| 13 | +# void funone(int one, int two) { |
| 14 | +# two = two + one; |
| 15 | +# // 'two = ...' sunk between the inlined assignments to globa and globa. |
| 16 | +# set(one, two); |
| 17 | +# if (two > 0) |
| 18 | +# return ext(); |
| 19 | +# } |
| 20 | +# void funtwo(int one, int two) { |
| 21 | +# two = one + two; |
| 22 | +# // 'two = ...' sunk between the inlined assignments to globa and globa, |
| 23 | +# // and rdi is clobbered by the sunk 'two = ...'. |
| 24 | +# set(one, two); |
| 25 | +# if (one < two) |
| 26 | +# return ext(); |
| 27 | +# } |
| 28 | +# |
| 29 | +# Check that the 'parama' is available for the entire inlined scope in funone, |
| 30 | +# and that it is unavailable in the second DW_AT_ranges segment of the inlined |
| 31 | +# scope in funtwo. In both cases the inlined scope 'set' is intrerrupted by an |
| 32 | +# instruction from the calling function. |
| 33 | +# |
| 34 | +# Except for 'parama', all DILocalVariable metadata has been removed. |
| 35 | +# |
| 36 | +# Ignore first entry (abstract), we want to look at the concrete instances. |
| 37 | +# CHECK: DW_TAG_formal_parameter [ |
| 38 | +# CHECK: DW_TAG_formal_parameter [ |
| 39 | +# CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_reg5 RDI) |
| 40 | +# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "parama" |
| 41 | +# CHECK: DW_TAG_formal_parameter [ |
| 42 | +# CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] |
| 43 | +# CHECK-NEXT: [0x{{[0-9a-b]+}}, 0x{{[0-9a-b]+}}) |
| 44 | +# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "parama" |
| 45 | + |
| 46 | +--- | |
| 47 | + target triple = "x86_64-unknown-linux-gnu" |
| 48 | + |
| 49 | + @globa = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0 |
| 50 | + @globb = dso_local local_unnamed_addr global i32 0, align 4, !dbg !10 |
| 51 | + |
| 52 | + declare !dbg !6 dso_local void @ext(...) local_unnamed_addr |
| 53 | + declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 54 | + |
| 55 | + define dso_local void @funone(i32 %one, i32 %two) local_unnamed_addr !dbg !17 { |
| 56 | + entry: |
| 57 | + call void @llvm.dbg.value(metadata i32 %one, metadata !20, metadata !DIExpression()), !dbg !23 |
| 58 | + store i32 %one, i32* @globa, align 4, !dbg !25 |
| 59 | + %add = add nsw i32 %two, %one, !dbg !30 |
| 60 | + store i32 %add, i32* @globb, align 4, !dbg !31 |
| 61 | + %cmp = icmp sgt i32 %add, 0, !dbg !32 |
| 62 | + br i1 %cmp, label %if.then, label %if.end, !dbg !34 |
| 63 | + |
| 64 | + if.then: ; preds = %entry |
| 65 | + tail call void (...) @ext(), !dbg !35 |
| 66 | + ret void, !dbg !36 |
| 67 | + |
| 68 | + if.end: ; preds = %entry |
| 69 | + ret void, !dbg !36 |
| 70 | + } |
| 71 | + |
| 72 | + define dso_local void @funtwo(i32 %one, i32 %two) local_unnamed_addr !dbg !37 { |
| 73 | + entry: |
| 74 | + call void @llvm.dbg.value(metadata i32 %one, metadata !20, metadata !DIExpression()), !dbg !41 |
| 75 | + store i32 %one, i32* @globa, align 4, !dbg !43 |
| 76 | + %add = add nsw i32 %two, %one, !dbg !44 |
| 77 | + store i32 %add, i32* @globb, align 4, !dbg !45 |
| 78 | + %cmp = icmp sgt i32 %two, 0, !dbg !46 |
| 79 | + br i1 %cmp, label %if.then, label %if.end, !dbg !48 |
| 80 | + |
| 81 | + if.then: ; preds = %entry |
| 82 | + tail call void (...) @ext(), !dbg !49 |
| 83 | + ret void, !dbg !50 |
| 84 | + |
| 85 | + if.end: ; preds = %entry |
| 86 | + ret void, !dbg !50 |
| 87 | + } |
| 88 | + |
| 89 | + !llvm.dbg.cu = !{!2} |
| 90 | + !llvm.module.flags = !{!13, !14, !15} |
| 91 | + !llvm.ident = !{!16} |
| 92 | + |
| 93 | + !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 94 | + !1 = distinct !DIGlobalVariable(name: "globa", scope: !2, file: !3, line: 16, type: !12, isLocal: false, isDefinition: true) |
| 95 | + !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !9, splitDebugInlining: false, nameTableKind: None) |
| 96 | + !3 = !DIFile(filename: "test.c", directory: "/") |
| 97 | + !4 = !{} |
| 98 | + !5 = !{!6} |
| 99 | + !6 = !DISubprogram(name: "ext", scope: !3, file: !3, line: 17, type: !7, spFlags: DISPFlagOptimized, retainedNodes: !4) |
| 100 | + !7 = !DISubroutineType(types: !8) |
| 101 | + !8 = !{null, null} |
| 102 | + !9 = !{!0, !10} |
| 103 | + !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression()) |
| 104 | + !11 = distinct !DIGlobalVariable(name: "globb", scope: !2, file: !3, line: 16, type: !12, isLocal: false, isDefinition: true) |
| 105 | + !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 106 | + !13 = !{i32 7, !"Dwarf Version", i32 4} |
| 107 | + !14 = !{i32 2, !"Debug Info Version", i32 3} |
| 108 | + !15 = !{i32 1, !"wchar_size", i32 4} |
| 109 | + !16 = !{!"clang version 11.0.0"} |
| 110 | + !17 = distinct !DISubprogram(name: "funone", scope: !3, file: !3, line: 22, type: !18, scopeLine: 22, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4) |
| 111 | + !18 = !DISubroutineType(types: !19) |
| 112 | + !19 = !{null, !12, !12} |
| 113 | + !20 = !DILocalVariable(name: "parama", arg: 1, scope: !21, file: !3, line: 18, type: !12) |
| 114 | + !21 = distinct !DISubprogram(name: "set", scope: !3, file: !3, line: 18, type: !18, scopeLine: 18, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !22) |
| 115 | + !22 = !{!20} |
| 116 | + !23 = !DILocation(line: 0, scope: !21, inlinedAt: !24) |
| 117 | + !24 = distinct !DILocation(line: 24, column: 3, scope: !17) |
| 118 | + !25 = !DILocation(line: 19, column: 9, scope: !21, inlinedAt: !24) |
| 119 | + !30 = !DILocation(line: 23, column: 13, scope: !17) |
| 120 | + !31 = !DILocation(line: 20, column: 9, scope: !21, inlinedAt: !24) |
| 121 | + !32 = !DILocation(line: 25, column: 11, scope: !33) |
| 122 | + !33 = distinct !DILexicalBlock(scope: !17, file: !3, line: 25, column: 7) |
| 123 | + !34 = !DILocation(line: 25, column: 7, scope: !17) |
| 124 | + !35 = !DILocation(line: 26, column: 12, scope: !33) |
| 125 | + !36 = !DILocation(line: 27, column: 1, scope: !17) |
| 126 | + !37 = distinct !DISubprogram(name: "funtwo", scope: !3, file: !3, line: 28, type: !18, scopeLine: 28, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !38) |
| 127 | + !38 = !{} |
| 128 | + !41 = !DILocation(line: 0, scope: !21, inlinedAt: !42) |
| 129 | + !42 = distinct !DILocation(line: 30, column: 3, scope: !37) |
| 130 | + !43 = !DILocation(line: 19, column: 9, scope: !21, inlinedAt: !42) |
| 131 | + !44 = !DILocation(line: 29, column: 13, scope: !37) |
| 132 | + !45 = !DILocation(line: 20, column: 9, scope: !21, inlinedAt: !42) |
| 133 | + !46 = !DILocation(line: 31, column: 11, scope: !47) |
| 134 | + !47 = distinct !DILexicalBlock(scope: !37, file: !3, line: 31, column: 7) |
| 135 | + !48 = !DILocation(line: 31, column: 7, scope: !37) |
| 136 | + !49 = !DILocation(line: 32, column: 12, scope: !47) |
| 137 | + !50 = !DILocation(line: 33, column: 1, scope: !37) |
| 138 | + |
| 139 | +... |
| 140 | +--- |
| 141 | +name: funone |
| 142 | +body: | |
| 143 | + bb.0.entry: |
| 144 | + successors: %bb.2(0x50000000), %bb.1(0x30000000) |
| 145 | + liveins: $edi, $esi |
| 146 | +
|
| 147 | + DBG_VALUE $edi, $noreg, !20, !DIExpression(), debug-location !23 |
| 148 | + MOV32mr $rip, 1, $noreg, @globa, $noreg, renamable $edi, debug-location !25 :: (store 4 into @globa) |
| 149 | + renamable $esi = ADD32rr killed renamable $esi, killed renamable $edi, implicit-def $eflags, debug-location !32 |
| 150 | + MOV32mr $rip, 1, $noreg, @globb, $noreg, killed renamable $esi, debug-location !31 :: (store 4 into @globb) |
| 151 | + JCC_1 %bb.1, 14, implicit $eflags, debug-location !34 |
| 152 | +
|
| 153 | + bb.2.if.then: |
| 154 | + dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al, debug-location !35 |
| 155 | + TAILJMPd64 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $al, debug-location !35 |
| 156 | +
|
| 157 | + bb.1.if.end: |
| 158 | + RETQ debug-location !36 |
| 159 | +
|
| 160 | +... |
| 161 | +--- |
| 162 | +name: funtwo |
| 163 | +body: | |
| 164 | + bb.0.entry: |
| 165 | + successors: %bb.2(0x50000000), %bb.1(0x30000000) |
| 166 | + liveins: $edi, $esi |
| 167 | +
|
| 168 | + DBG_VALUE $edi, $noreg, !20, !DIExpression(), debug-location !41 |
| 169 | + MOV32mr $rip, 1, $noreg, @globa, $noreg, renamable $edi, debug-location !43 :: (store 4 into @globa) |
| 170 | + renamable $edi = nsw ADD32rr killed renamable $edi, renamable $esi, implicit-def dead $eflags, debug-location !44 |
| 171 | + MOV32mr $rip, 1, $noreg, @globb, $noreg, killed renamable $edi, debug-location !45 :: (store 4 into @globb) |
| 172 | + TEST32rr killed renamable $esi, renamable $esi, implicit-def $eflags, debug-location !46 |
| 173 | + JCC_1 %bb.1, 14, implicit $eflags, debug-location !48 |
| 174 | +
|
| 175 | + bb.2.if.then: |
| 176 | + dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al, debug-location !49 |
| 177 | + TAILJMPd64 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $al, debug-location !49 |
| 178 | +
|
| 179 | + bb.1.if.end: |
| 180 | + RETQ debug-location !50 |
| 181 | +
|
| 182 | +... |
0 commit comments