1# RUN: llc -mtriple=thumbv8 -run-pass=peephole-opt %s -o - | FileCheck %s
2
3# Test case for PR 47980:
4# Ensure that peephole optimization to fold move immediate doesn't unconstrain
5# the register class of the consumer.
6#
7# Check that register class for %5 is unchanged as 'tcgpr'
8# CHECK: { id: 5, class: tcgpr, preferred-register: '' }
9# CHECK: TCRETURNri killed %5
10
11--- |
12  define i32 @foo(i32 %in) {
13    ret i32 undef
14  }
15...
16---
17name:            foo
18registers:
19  - { id: 0, class: gpr}
20  - { id: 1, class: gpr }
21  - { id: 2, class: rgpr }
22  - { id: 3, class: gpr }
23  - { id: 4, class: rgpr }
24  - { id: 5, class: tcgpr }
25liveins:
26  - { reg: '$r0', virtual-reg: '%0' }
27  - { reg: '$r1', virtual-reg: '%1' }
28  - { reg: '$r2', virtual-reg: '%2' }
29  - { reg: '$r3', virtual-reg: '%3' }
30body:             |
31  bb.0 (%ir-block.0):
32    liveins: $r0, $r1, $r2, $r3
33    %0 = COPY $r0
34    %1 = COPY $r1
35    %2 = COPY $r2
36    %3 = COPY $r3
37
38    %4 = t2MOVi32imm 270337
39    %5 = t2ADDrr killed %2, killed %4, 14, $noreg, $noreg
40    $r0 = COPY %0
41    $r1 = COPY %1
42    $r2 = COPY %2
43    $r3 = COPY %3
44    TCRETURNri killed %5, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3
45...
46