|
| 1 | +--- | |
| 2 | + ; RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s |
| 3 | + ; Created from: |
| 4 | + ; void sink(int a); |
| 5 | + ; void __attribute((always_inline)) f(int a) { sink(a); } |
| 6 | + ; void foo(int i) { |
| 7 | + ; f(i); |
| 8 | + ; if (i) |
| 9 | + ; f(i); |
| 10 | + ; f(i); |
| 11 | + ; } |
| 12 | + ; |
| 13 | + ; This test verifies that LiveDebugValues doesn't propagate DBG_VALUEs into |
| 14 | + ; basic blocks that are beyond the scope of the source variable. |
| 15 | + ; |
| 16 | + ; CHECK: bb.1.if.then: |
| 17 | + ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 |
| 18 | + ; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !21 |
| 19 | + ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !27 |
| 20 | + ; CHECK: bb.2.if.end: |
| 21 | + ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 |
| 22 | + ; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !21 |
| 23 | + ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !31 |
| 24 | + ; |
| 25 | + ; ModuleID = 'livedebugvalues-limit.ll' |
| 26 | + source_filename = "livedebugvalues-limit.c" |
| 27 | + target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 28 | + target triple = "x86_64-apple-macosx" |
| 29 | + |
| 30 | + ; Function Attrs: alwaysinline nounwind ssp uwtable |
| 31 | + define void @f(i32 %a) local_unnamed_addr #0 !dbg !7 { |
| 32 | + entry: |
| 33 | + tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !12, metadata !13), !dbg !14 |
| 34 | + tail call void @sink(i32 %a) #4, !dbg !15 |
| 35 | + ret void, !dbg !16 |
| 36 | + } |
| 37 | + |
| 38 | + declare void @sink(i32) local_unnamed_addr |
| 39 | + |
| 40 | + ; Function Attrs: nounwind ssp uwtable |
| 41 | + define void @foo(i32 %i) local_unnamed_addr #2 !dbg !17 { |
| 42 | + entry: |
| 43 | + tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !19, metadata !13), !dbg !20 |
| 44 | + tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !21 |
| 45 | + tail call void @sink(i32 %i) #4, !dbg !23 |
| 46 | + %tobool = icmp eq i32 %i, 0, !dbg !24 |
| 47 | + br i1 %tobool, label %if.end, label %if.then, !dbg !26 |
| 48 | + |
| 49 | + if.then: ; preds = %entry |
| 50 | + tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !27 |
| 51 | + tail call void @sink(i32 %i) #4, !dbg !29 |
| 52 | + br label %if.end, !dbg !30 |
| 53 | + |
| 54 | + if.end: ; preds = %if.then, %entry |
| 55 | + tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !31 |
| 56 | + tail call void @sink(i32 %i) #4, !dbg !33 |
| 57 | + ret void, !dbg !34 |
| 58 | + } |
| 59 | + |
| 60 | + ; Function Attrs: nounwind readnone |
| 61 | + declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #3 |
| 62 | + |
| 63 | + ; Function Attrs: nounwind |
| 64 | + declare void @llvm.stackprotector(i8*, i8**) #4 |
| 65 | + |
| 66 | + attributes #0 = { alwaysinline nounwind ssp uwtable } |
| 67 | + attributes #2 = { nounwind ssp uwtable } |
| 68 | + attributes #3 = { nounwind readnone } |
| 69 | + attributes #4 = { nounwind } |
| 70 | + |
| 71 | + !llvm.dbg.cu = !{!0} |
| 72 | + !llvm.module.flags = !{!3, !4, !5} |
| 73 | + !llvm.ident = !{!6} |
| 74 | + |
| 75 | + !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 281923) (llvm/trunk 281916)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
| 76 | + !1 = !DIFile(filename: "livedebugvalues-limit.c", directory: "/Volumes/Fusion/Data/llvm") |
| 77 | + !2 = !{} |
| 78 | + !3 = !{i32 2, !"Dwarf Version", i32 4} |
| 79 | + !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 80 | + !5 = !{i32 1, !"PIC Level", i32 2} |
| 81 | + !6 = !{!"clang version 4.0.0 (trunk 281923) (llvm/trunk 281916)"} |
| 82 | + !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !11) |
| 83 | + !8 = !DISubroutineType(types: !9) |
| 84 | + !9 = !{null, !10} |
| 85 | + !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 86 | + !11 = !{!12} |
| 87 | + !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 3, type: !10) |
| 88 | + !13 = !DIExpression() |
| 89 | + !14 = !DILocation(line: 3, column: 41, scope: !7) |
| 90 | + !15 = !DILocation(line: 3, column: 46, scope: !7) |
| 91 | + !16 = !DILocation(line: 3, column: 55, scope: !7) |
| 92 | + !17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !18) |
| 93 | + !18 = !{!19} |
| 94 | + !19 = !DILocalVariable(name: "i", arg: 1, scope: !17, file: !1, line: 4, type: !10) |
| 95 | + !20 = !DILocation(line: 4, column: 14, scope: !17) |
| 96 | + !21 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !22) |
| 97 | + !22 = distinct !DILocation(line: 5, column: 3, scope: !17) |
| 98 | + !23 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !22) |
| 99 | + !24 = !DILocation(line: 6, column: 7, scope: !25) |
| 100 | + !25 = distinct !DILexicalBlock(scope: !17, file: !1, line: 6, column: 7) |
| 101 | + !26 = !DILocation(line: 6, column: 7, scope: !17) |
| 102 | + !27 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !28) |
| 103 | + !28 = distinct !DILocation(line: 7, column: 5, scope: !25) |
| 104 | + !29 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !28) |
| 105 | + !30 = !DILocation(line: 7, column: 5, scope: !25) |
| 106 | + !31 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !32) |
| 107 | + !32 = distinct !DILocation(line: 8, column: 3, scope: !17) |
| 108 | + !33 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !32) |
| 109 | + !34 = !DILocation(line: 9, column: 1, scope: !17) |
| 110 | + |
| 111 | +... |
| 112 | +--- |
| 113 | +name: f |
| 114 | +alignment: 4 |
| 115 | +exposesReturnsTwice: false |
| 116 | +legalized: false |
| 117 | +regBankSelected: false |
| 118 | +selected: false |
| 119 | +tracksRegLiveness: true |
| 120 | +liveins: |
| 121 | + - { reg: '%edi' } |
| 122 | +calleeSavedRegisters: [ '%bh', '%bl', '%bp', '%bpl', '%bx', '%ebp', '%ebx', |
| 123 | + '%rbp', '%rbx', '%r12', '%r13', '%r14', '%r15', |
| 124 | + '%r12b', '%r13b', '%r14b', '%r15b', '%r12d', '%r13d', |
| 125 | + '%r14d', '%r15d', '%r12w', '%r13w', '%r14w', '%r15w' ] |
| 126 | +frameInfo: |
| 127 | + isFrameAddressTaken: false |
| 128 | + isReturnAddressTaken: false |
| 129 | + hasStackMap: false |
| 130 | + hasPatchPoint: false |
| 131 | + stackSize: 8 |
| 132 | + offsetAdjustment: 0 |
| 133 | + maxAlignment: 0 |
| 134 | + adjustsStack: false |
| 135 | + hasCalls: false |
| 136 | + maxCallFrameSize: 0 |
| 137 | + hasOpaqueSPAdjustment: false |
| 138 | + hasVAStart: false |
| 139 | + hasMustTailInVarArgFunc: false |
| 140 | +fixedStack: |
| 141 | + - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 } |
| 142 | +body: | |
| 143 | + bb.0.entry: |
| 144 | + liveins: %edi, %rbp |
| 145 | + |
| 146 | + frame-setup PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp |
| 147 | + CFI_INSTRUCTION def_cfa_offset 16 |
| 148 | + CFI_INSTRUCTION offset %rbp, -16 |
| 149 | + %rbp = frame-setup MOV64rr %rsp |
| 150 | + CFI_INSTRUCTION def_cfa_register %rbp |
| 151 | + DBG_VALUE debug-use %edi, debug-use _, !12, !13, debug-location !14 |
| 152 | + %rbp = POP64r implicit-def %rsp, implicit %rsp, debug-location !15 |
| 153 | + TAILJMPd64 @sink, csr_64, implicit %rsp, implicit %rsp, implicit %edi, debug-location !15 |
| 154 | +
|
| 155 | +... |
| 156 | +--- |
| 157 | +name: foo |
| 158 | +alignment: 4 |
| 159 | +exposesReturnsTwice: false |
| 160 | +legalized: false |
| 161 | +regBankSelected: false |
| 162 | +selected: false |
| 163 | +tracksRegLiveness: true |
| 164 | +liveins: |
| 165 | + - { reg: '%edi' } |
| 166 | +calleeSavedRegisters: [ '%bh', '%bl', '%bp', '%bpl', '%bx', '%ebp', '%ebx', |
| 167 | + '%rbp', '%rbx', '%r12', '%r13', '%r14', '%r15', |
| 168 | + '%r12b', '%r13b', '%r14b', '%r15b', '%r12d', '%r13d', |
| 169 | + '%r14d', '%r15d', '%r12w', '%r13w', '%r14w', '%r15w' ] |
| 170 | +frameInfo: |
| 171 | + isFrameAddressTaken: false |
| 172 | + isReturnAddressTaken: false |
| 173 | + hasStackMap: false |
| 174 | + hasPatchPoint: false |
| 175 | + stackSize: 24 |
| 176 | + offsetAdjustment: -8 |
| 177 | + maxAlignment: 0 |
| 178 | + adjustsStack: true |
| 179 | + hasCalls: true |
| 180 | + maxCallFrameSize: 0 |
| 181 | + hasOpaqueSPAdjustment: false |
| 182 | + hasVAStart: false |
| 183 | + hasMustTailInVarArgFunc: false |
| 184 | +fixedStack: |
| 185 | + - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '%rbx' } |
| 186 | + - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16 } |
| 187 | +body: | |
| 188 | + bb.0.entry: |
| 189 | + successors: %bb.2.if.end, %bb.1.if.then |
| 190 | + liveins: %edi, %rbx, %rbp |
| 191 | + |
| 192 | + frame-setup PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp |
| 193 | + CFI_INSTRUCTION def_cfa_offset 16 |
| 194 | + CFI_INSTRUCTION offset %rbp, -16 |
| 195 | + %rbp = frame-setup MOV64rr %rsp |
| 196 | + CFI_INSTRUCTION def_cfa_register %rbp |
| 197 | + frame-setup PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp |
| 198 | + frame-setup PUSH64r undef %rax, implicit-def %rsp, implicit %rsp |
| 199 | + CFI_INSTRUCTION offset %rbx, -24 |
| 200 | + DBG_VALUE debug-use %edi, debug-use _, !19, !13, debug-location !20 |
| 201 | + %ebx = MOV32rr %edi |
| 202 | + DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !21 |
| 203 | + DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 |
| 204 | + CALL64pcrel32 @sink, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp, debug-location !23 |
| 205 | + TEST32rr %ebx, %ebx, implicit-def %eflags, debug-location !24 |
| 206 | + JE_1 %bb.2.if.end, implicit %eflags |
| 207 | + |
| 208 | + bb.1.if.then: |
| 209 | + successors: %bb.2.if.end |
| 210 | + liveins: %ebx, %rbp |
| 211 | + |
| 212 | + DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 |
| 213 | + DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !27 |
| 214 | + %edi = MOV32rr %ebx, debug-location !29 |
| 215 | + CALL64pcrel32 @sink, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp, debug-location !29 |
| 216 | + |
| 217 | + bb.2.if.end: |
| 218 | + liveins: %ebx, %rbp |
| 219 | + |
| 220 | + DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 |
| 221 | + %edi = MOV32rr killed %ebx, debug-location !33 |
| 222 | + %rsp = ADD64ri8 %rsp, 8, implicit-def dead %eflags, debug-location !33 |
| 223 | + DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !31 |
| 224 | + %rbx = POP64r implicit-def %rsp, implicit %rsp, debug-location !33 |
| 225 | + %rbp = POP64r implicit-def %rsp, implicit %rsp, debug-location !33 |
| 226 | + TAILJMPd64 @sink, csr_64, implicit %rsp, implicit %rsp, implicit %edi, debug-location !33 |
| 227 | +
|
| 228 | +... |
0 commit comments