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 }
12#
13# CHECK:      LEA64_32r
14# CHECK-SAME: debug-instr-number 2
15#
16# CHECK:      DBG_INSTR_REF 1, 0
17---
18name:            test1
19alignment:       16
20tracksRegLiveness: true
21registers:
22  - { id: 0, class: gr32 }
23  - { id: 1, class: gr32 }
24  - { id: 2, class: gr32 }
25liveins:
26  - { reg: '$edi', virtual-reg: '%0' }
27frameInfo:
28  maxAlignment:    1
29machineFunctionInfo: {}
30body:             |
31  bb.0:
32    liveins: $edi
33
34    %0:gr32 = COPY killed $edi
35    %1:gr32 = SHL32ri killed %0, 5, implicit-def dead $eflags
36    %2:gr32 = ADD32ri8_DB killed %1, 3, implicit-def dead $eflags, debug-instr-number 1
37    DBG_INSTR_REF 1, 0
38    $eax = COPY killed %2
39    RET 0, killed $eax
40
41...
42
43