xref: /llvm-project/llvm/test/DebugInfo/MIR/InstrRef/twoaddr-to-threeaddr-sub.mir (revision d53425e2a33a0ff7336c86d3f668b1855c47a6de)
1# RUN: llc -run-pass=twoaddressinstruction -mtriple=x86_64-- -o - %s -experimental-debug-variable-locations | FileCheck %s
2#
3# REQUIRES: x86-registered-target
4#
5# Test that a new instruction (LEA) is created when the two-addr add below is
6# converted to three address; and that an appropriate substitution is created.
7# Maybe at some point we'll normalise DBG_INSTR_REFs on output, but until then,
8# lets not.
9#
10# CHECK:      debugValueSubstitutions:
11# CHECK-NEXT:  - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }
12#
13# CHECK:      LEA64_32r
14# CHECK-SAME: debug-instr-number 2
15#
16# CHECK:      DBG_INSTR_REF dbg-instr-ref(1, 0)
17---
18name:            test1
19alignment:       16
20tracksRegLiveness: true
21debugInstrRef: true
22registers:
23  - { id: 0, class: gr32 }
24  - { id: 1, class: gr32 }
25  - { id: 2, class: gr32 }
26liveins:
27  - { reg: '$edi', virtual-reg: '%0' }
28frameInfo:
29  maxAlignment:    1
30machineFunctionInfo: {}
31body:             |
32  bb.0:
33    liveins: $edi
34
35    %0:gr32 = COPY killed $edi
36    %1:gr32 = SHL32ri killed %0, 5, implicit-def dead $eflags
37    %2:gr32 = ADD32ri_DB killed %1, 3, implicit-def dead $eflags, debug-instr-number 1
38    DBG_INSTR_REF dbg-instr-ref(1, 0)
39    $eax = COPY killed %2
40    RET 0, killed $eax
41
42...
43
44