brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 49b01dd Raw
108 lines · plain
1# RUN: llc %s -o - -experimental-debug-variable-locations=true \2# RUN:   -run-pass=livedebugvalues \3# RUN: | FileCheck %s --implicit-check-not=DBG_VALUE4# RUN: llc %s -o - -experimental-debug-variable-locations=true \5# RUN:   -start-before=livedebugvalues -filetype=obj \6# RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF7#8# LLVM can produce DIExpressions that convert from one value of arbitrary size9# to another. This is normally fine, however that means the value for a10# variable tracked in instruction referencing might not be the same size as the11# variable itself.12#13# We typically use vector registers as shorthand for "the lower lane of the14# vector register", for example if we have a single float we might say15#16#     DBG_VALUE $xmm017#18# and that's reflected in DWARF too. However, instruction-referencing tries to19# solve several size problems (see deref-spills-with-size.mir), and gets20# confused by this shorthand. It manifests in the test sequence below: we21# locate a variable in a vector register, spill it, then force a stack variable22# location to be produced. InstrRefBasedLDV would like to produce a23# DW_OP_deref_size indicating that 128 bits should be loaded for the 32 bit24# register, but this would be wrong (and illegal DWARF as the max load size is25# the pointer size).26#27# As a sticking-plaster fix: detect when we're about to emit these illegal28# DWARF locations, and instead use DW_OP_deref_size. There's a small risk we29# read too much or too little data, but it's better than emitting illegal DWARF.30 31# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "flannel",32 33## Check that we're not producing DW_OP_deref_size, instead using the isIndirect34## field of DBG_VALUEs.35 36# CHECK: DBG_VALUE $xmm0, $noreg,37# CHECK: DBG_VALUE $rsp, 0, ![[VAR]], !DIExpression(DW_OP_plus_uconst, 8),38 39## Check that we produce a breg location with no further expression attached.40 41# DWARF:      DW_TAG_variable42# DWARF-NEXT:     DW_AT_location43# DWARF-NEXT:         DW_OP_reg17 XMM044# DWARF-NEXT:         DW_OP_breg7 RSP+8)45# DWARF-NEXT:     DW_AT_name    ("flannel")46 47--- |48  ; ModuleID = 'missingvar.ll'49  source_filename = "a"50  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"51  target triple = "x86_64-unknown-linux-gnu"52  53  define linkonce_odr void @_ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_() local_unnamed_addr align 2 !dbg !3 {54  entry:55    call void @llvm.dbg.value(metadata i32 0, metadata !8, metadata !DIExpression()), !dbg !756    call void @llvm.dbg.value(metadata i32 0, metadata !10, metadata !DIExpression()), !dbg !757    ret void58  }59 60  declare void @llvm.dbg.value(metadata, metadata, metadata)61  62  !llvm.module.flags = !{!0, !9}63  !llvm.dbg.cu = !{!1}64  65  !0 = !{i32 2, !"Debug Info Version", i32 3}66  !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "beards", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug)67  !2 = !DIFile(filename: "bees.cpp", directory: "")68  !3 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1)69  !4 = !DISubroutineType(types: !5)70  !5 = !{!6}71  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)72  !7 = !DILocation(line: 1, scope: !3)73  !8 = !DILocalVariable(name: "flannel", scope: !3, type: !6)74  !9 = !{i32 2, !"Dwarf Version", i32 5}75  !10 = !DILocalVariable(name: "shoes", scope: !3, type: !11)76  !11 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)77 78 79...80---81name:            _ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_82alignment:       1683tracksRegLiveness: true84debugInstrRef: true85liveins:86  - { reg: '$rdi' }87  - { reg: '$rsi' }88  - { reg: '$rdx' }89frameInfo:90  stackSize:       1691  offsetAdjustment: -1692  maxAlignment:    1693  maxCallFrameSize: 094stack:95  - { id: 6, type: spill-slot, offset: -16, size: 16, alignment: 16 }96machineFunctionInfo: {}97body:             |98  bb.0.entry:99    liveins: $rdi, $rdx, $rsi, $rbp, $xmm0100  101 102    $xmm0 = XORPSrr $xmm0, $xmm0, debug-location !7103    DBG_VALUE $xmm0, $noreg, !8, !DIExpression(), debug-location !7104    VMOVUPSmr $rsp, 1, $noreg, 36, $noreg, $xmm0 :: (store (s128) into %stack.6)105    $xmm0 = XORPSrr $xmm0, $xmm0, debug-location !7106    RET64 0, debug-location !7107...108