1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=CHECK
# RUN: llc %s -o - -start-before=livedebugvalues -filetype=obj -mtriple=x86_64-unknown-unknown | llvm-dwarfdump - | FileCheck %s --check-prefix=RANGES
# Check that livedebugvalues does the right thing when register and constant
# DBG_VALUEs interact, and that their ranges are correctly terminated by the
# debug printing backend.
--- |
; All these IR functions are duds, see the MIR below.
source_filename = "<stdin>"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define i32 @foo(i32* %bees, i32* %output) !dbg !4 {
entry:
br i1 undef, label %bb1, label %bb1
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret i32 0
}
define i32 @bar(i32* %bees, i32* %output) !dbg !40 {
entry:
br i1 undef, label %bb1, label %bb1
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret i32 0
}
define i32 @baz(i32* %bees, i32* %output) !dbg !80 {
entry:
br i1 undef, label %bb1, label %bb1
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret i32 0
}
define i32 @qux(i32* %bees, i32* %output) !dbg !120 {
entry:
br i1 undef, label %bb1, label %bb1
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
ret i32 0
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata)
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata)
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**)
!llvm.module.flags = !{!0, !100}
!llvm.dbg.cu = !{!1}
!100 = !{i32 2, !"Dwarf Version", i32 4}
!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "beards", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
!2 = !DIFile(filename: "bees.cpp", directory: ".")
!3 = !DILocalVariable(name: "flannel", scope: !4, file: !2, line: 1, type: !16)
!4 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)
!5 = !DILocation(line: 0, scope: !4)
!6 = !DILocation(line: 1, scope: !4)
!7 = !DILocation(line: 2, scope: !4)
!8 = !DILocation(line: 4, scope: !4)
!9 = !DILocation(line: 5, scope: !4)
!10 = !DILocation(line: 6, scope: !4)
!11 = !DILocation(line: 7, scope: !4)
!12 = !DILocation(line: 8, scope: !4)
!13 = !{!3}
!14 = !DISubroutineType(types: !15)
!15 = !{!16}
!16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!40 = distinct !DISubprogram(name: "bar", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)
!41 = !DILocalVariable(name: "towel", scope: !40, file: !2, line: 1, type: !16)
!42 = !DILocation(line: 40, scope: !40)
!80 = distinct !DISubprogram(name: "baz", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)
!81 = !DILocalVariable(name: "socks", scope: !80, file: !2, line: 1, type: !16)
!82 = !DILocation(line: 40, scope: !80)
!120 = distinct !DISubprogram(name: "qux", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)
!121 = !DILocalVariable(name: "shoes", scope: !120, file: !2, line: 1, type: !16)
!122 = !DILocation(line: 40, scope: !120)
...
---
name: foo
alignment: 16
tracksRegLiveness: true
registers: []
liveins:
- { reg: '$rdi', virtual-reg: '' }
body: |
; Two DBG_VALUEs for eax merge into bb3, check that livedebugvalues propagates
; the location.
; CHECK-LABEL: name: foo
; CHECK-LABEL: bb.1.bb1
; CHECK: $eax = MOV32rr
; CHECK-NEXT: DBG_VALUE $eax
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.2.bb2
; CHECK: $eax = ADD32ri8
; CHECK-NEXT: DBG_VALUE $eax
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.3.bb3
; CHECK: DBG_VALUE $eax
; Test for there being a location-list gap between bb1 and bb2, as the
; variable does not have a location over the ADD32ri. The range should also
; extend over the final bb.
; RANGES-LABEL: DW_TAG_subprogram
; RANGES: DW_AT_high_pc (0x[[NOPEHIGHPC:[0-9a-f]+]])
; RANGES-LABEL: DW_AT_name ("nope")
; RANGES: DW_AT_location (0x{{[0-9a-f]+}}
; RANGES-NEXT: [0x{{[0-9a-f]+}}, 0x[[NOPEADDR:[0-9a-f]+]]): DW_OP_reg0 RAX
; RANGES-NEXT: [
; RANGES-NOT: 0x[[NOPEADDR]]
; RANGES-SAME: , 0x[[NOPEHIGHPC]]): DW_OP_reg0 RAX
bb.0.entry:
successors: %bb.1, %bb.2
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
JCC_1 %bb.1, 2, implicit killed $eflags
JMP_1 %bb.2
bb.1.bb1 (align 4):
successors: %bb.3
liveins: $ecx, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
DBG_VALUE $eax, $noreg, !3, !DIExpression(), debug-location !8
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
liveins: $rax
$eax = ADD32ri8 $eax, 3, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax
DBG_VALUE $eax, $noreg, !3, !DIExpression(), debug-location !8
JMP_1 %bb.3
bb.3.bb3:
liveins: $rax
RET64 $eax, debug-location !9
...
---
name: bar
alignment: 16
tracksRegLiveness: true
registers: []
liveins:
- { reg: '$rdi', virtual-reg: '' }
body: |
; Two DBG_VALUEs, one for eax, the other for zero, merge into bb3. Check that
; livedebugvalues does not propagate anything.
; the location.
; CHECK-LABEL: name: bar
; CHECK-LABEL: bb.1.bb1
; CHECK: $eax = MOV32rr
; CHECK-NEXT: DBG_VALUE 0
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.2.bb2
; CHECK: $eax = ADD32ri8
; CHECK-NEXT: DBG_VALUE $eax
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.3.bb3
; CHECK-NOT: DBG_VALUE
; Test for there being a location-list gap between bb1 and bb2, the variable
; should not have a location over the ADD32ri. The range of the last entry
; should not cover the last block.
; RANGES-LABEL: DW_TAG_subprogram
; RANGES: DW_AT_high_pc (0x[[BARHIGHPC:[0-9a-f]+]])
; RANGES-LABEL: DW_AT_name ("bar")
; RANGES: DW_AT_location (0x{{[0-9a-f]+}}
; RANGES-NEXT: [0x{{[0-9a-f]+}}, 0x[[BARADDR:[0-9a-f]+]]): DW_OP_consts +0, DW_OP_stack_value
; RANGES-NEXT: [
; RANGES-NOT: 0x[[BARADDR]]
; RANGES-NOT: 0x[[BARHIGHPC]]
; RANGES-SAME: ): DW_OP_reg0 RAX
bb.0.entry:
successors: %bb.1, %bb.2
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
JCC_1 %bb.1, 2, implicit killed $eflags
JMP_1 %bb.2
bb.1.bb1 (align 4):
successors: %bb.3
liveins: $ecx, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
DBG_VALUE 0, $noreg, !41, !DIExpression(), debug-location !42
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
liveins: $rax
$eax = ADD32ri8 $eax, 3, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax
DBG_VALUE $eax, $noreg, !41, !DIExpression(), debug-location !42
JMP_1 %bb.3
bb.3.bb3:
liveins: $rax
RET64 $eax, debug-location !42
...
---
name: baz
alignment: 16
tracksRegLiveness: true
registers: []
liveins:
- { reg: '$rdi', virtual-reg: '' }
body: |
; Two DBG_VALUEs, one for zero, the other for eax, merge into bb3. Check that
; livedebugvalues does not propagate anything.
; the location.
; CHECK-LABEL: name: baz
; CHECK-LABEL: bb.1.bb1
; CHECK: $eax = MOV32rr
; CHECK-NEXT: DBG_VALUE $eax
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.2.bb2
; CHECK: $eax = ADD32ri8
; CHECK-NEXT: DBG_VALUE 0
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.3.bb3
; CHECK-NOT: DBG_VALUE
; Test for there being a location-list gap between bb1 and bb2, the variable
; should not have a location over the ADD32ri. The range of the last item
; should not cover the last block.
; RANGES-LABEL: DW_TAG_subprogram
; RANGES: DW_AT_high_pc (0x[[BAZHIGHPC:[0-9a-f]+]])
; RANGES-LABEL: DW_AT_name ("baz")
; RANGES: DW_AT_location (0x{{[0-9a-f]+}}
; RANGES-NEXT: [0x{{[0-9a-f]+}}, 0x[[BAZADDR:[0-9a-f]+]]): DW_OP_reg0 RAX
; RANGES-NEXT: [
; RANGES-NOT: 0x[[BAZADDR]]
; RANGES-NOT: 0x[[BAZHIGHPC]]
; RANGES-SAME: ): DW_OP_consts +0, DW_OP_stack_value
bb.0.entry:
successors: %bb.1, %bb.2
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
JCC_1 %bb.1, 2, implicit killed $eflags
JMP_1 %bb.2
bb.1.bb1 (align 4):
successors: %bb.3
liveins: $ecx, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
DBG_VALUE $eax, $noreg, !81, !DIExpression(), debug-location !82
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
liveins: $rax
$eax = ADD32ri8 $eax, 3, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax
DBG_VALUE 0, $noreg, !81, !DIExpression(), debug-location !82
JMP_1 %bb.3
bb.3.bb3:
liveins: $rax
RET64 $eax, debug-location !82
...
---
name: qux
alignment: 16
tracksRegLiveness: true
registers: []
liveins:
- { reg: '$rdi', virtual-reg: '' }
body: |
; Two DBG_VALUEs for zero merging into bb3, Check that livedebugvalues does
; propagate the zero into the merging block.
; CHECK-LABEL: name: qux
; CHECK-LABEL: bb.1.bb1
; CHECK: $eax = MOV32rr
; CHECK-NEXT: DBG_VALUE 0
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.2.bb2
; CHECK: $eax = ADD32ri8
; CHECK-NEXT: DBG_VALUE 0
; CHECK-NEXT: JMP_1 %bb.3
; CHECK-LABEL: bb.3.bb3
; CHECK: DBG_VALUE 0
; Test for there being a location-list gap between bb1 and bb2, the variable
; should not have a location over the ADD32ri. The final entry should cover
; the final block.
; RANGES-LABEL: DW_TAG_subprogram
; RANGES: DW_AT_high_pc (0x[[QUXHIGHPC:[0-9a-f]+]])
; RANGES-LABEL: DW_AT_name ("qux")
; RANGES: DW_AT_location (0x{{[0-9a-f]+}}
; RANGES-NEXT: [0x{{[0-9a-f]+}}, 0x[[QUXADDR:[0-9a-f]+]]): DW_OP_consts +0, DW_OP_stack_value
; RANGES-NOT: 0x[[QUXADDR]]
; RANGES-NEXT: [0x{{[0-9a-f]+}}, 0x[[QUXHIGHPC]]): DW_OP_consts +0, DW_OP_stack_value
bb.0.entry:
successors: %bb.1, %bb.2
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
JCC_1 %bb.1, 2, implicit killed $eflags
JMP_1 %bb.2
bb.1.bb1 (align 4):
successors: %bb.3
liveins: $ecx, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
DBG_VALUE 0, $noreg, !121, !DIExpression(), debug-location !122
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
liveins: $rax
$eax = ADD32ri8 $eax, 3, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax
DBG_VALUE 0, $noreg, !121, !DIExpression(), debug-location !122
JMP_1 %bb.3
bb.3.bb3:
liveins: $rax
RET64 $eax, debug-location !122
...
|