86 lines · plain
1# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown -experimental-debug-variable-locations=false | FileCheck %s2#3# This is a regression test for register/stack variable locations being4# interpreted as each other. We place a variable location on the stack, based5# on $rsp. We later make a memory load from $rsp. On faulty versions of LLVM6# this gets interpreted as a stack restore of the spilt value (it's not).7#8# Test that LiveDebugValues does not create any new variable locations.9#10# CHECK-LABEL: name: baaar11# CHECK-LABEL: bb.0.entry:12# CHECK: DBG_VALUE $r9d, $noreg, !{{[0-9]*}}, !DIExpression()13# CHECK: DBG_VALUE $rsp, 0, !{{[0-9]*}}, !DIExpression(DW_OP_plus_uconst, 16)14# CHECK-NOT: DBG_VALUE15--- |16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"17 target triple = "x86_64-unknown-linux-gnu"18 19 define void @baaar() !dbg !4 {20 entry:21 ret void22 }23 24 !llvm.module.flags = !{!0, !1}25 !llvm.dbg.cu = !{!2}26 27 !0 = !{i32 2, !"Debug Info Version", i32 3}28 !1 = !{i32 2, !"Dwarf Version", i32 4}29 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)30 !3 = !DIFile(filename: "sheep.cpp", directory: ".")31 !4 = distinct !DISubprogram(name: "baaar", scope: !3, file: !3, line: 1, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)32 !5 = !DISubroutineType(types: !6)33 !6 = !{!7}34 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)35 !8 = !{!9}36 !9 = !DILocalVariable(name: "moo", scope: !4, file: !3, line: 1, type: !7)37 !10 = !DILocation(line: 1, scope: !4)38 39...40---41name: baaar42alignment: 1643tracksRegLiveness: true44liveins:45 - { reg: '$rdi', virtual-reg: '' }46 - { reg: '$rsi', virtual-reg: '' }47 - { reg: '$rdx', virtual-reg: '' }48 - { reg: '$rcx', virtual-reg: '' }49 - { reg: '$r8', virtual-reg: '' }50 - { reg: '$r9d', virtual-reg: '' }51frameInfo:52 stackSize: 2453 offsetAdjustment: -2454 maxAlignment: 855 adjustsStack: true56 hasCalls: true57fixedStack:58stack:59 - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8, 60 stack-id: default, callee-saved-register: '', callee-saved-restored: true, 61 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }62 - { id: 1, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8, 63 stack-id: default, callee-saved-register: '', callee-saved-restored: true, 64 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }65body: |66 bb.0.entry:67 liveins: $rcx, $rdi, $rdx, $rsi, $r8, $r9d, $rbp, $r15, $r14, $r13, $r12, $rbx68 69 ; Setup70 DBG_VALUE $r9d, $noreg, !9, !DIExpression(), debug-location !1071 $rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags72 73 ; Spill74 MOV32mr $rsp, 1, $noreg, 16, $noreg, $r9d :: (store (s32) into %stack.0)75 DBG_VALUE $rsp, 0, !9, !DIExpression(DW_OP_plus_uconst, 16), debug-location !1076 77 ; This load from the stack can be misinterpreted as a stack restore of78 ; any DBG_VALUe pointing at $rsp.79 $rsi = MOV64rm $rsp, 1, $noreg, 0, $noreg :: (load (s64) from %stack.1)80 81 ; Return faff82 $eax = MOV32ri 083 $rsp = frame-destroy ADD64ri8 $rsp, 24, implicit-def dead $eflags84 RET64 debug-location !1085...86