xref: /llvm-project/llvm/test/CodeGen/RISCV/MachineSink-implicit-x0.mir (revision 4e94e25c9024d01451e318fe48aee79b615e9c2b)
1# RUN: llc -mtriple=riscv32 %s -run-pass=machine-sink -o - | FileCheck %s
2
3# Verify that sinking of '%20:gpr = LUI 1, implicit $x0' is not inhibited by
4# the implicit use of '$x0'.
5# Register '$x0' is a 'MRI->isConstantPhysReg()' on RISCV and such uses should
6# not inhibit sinking transformation even though they are livein to the block
7# they are to be sunk into (inhibit under such conditions should only happen
8# for defines).
9
10---
11name:            f
12tracksRegLiveness: true
13body:             |
14  ; CHECK-LABEL: bb.1:
15  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
16  ; CHECK-NEXT:   liveins: $x0
17  ; CHECK-NEXT: {{  $}}
18  ; CHECK-NEXT:   [[LUI:%[0-9]+]]:gpr = LUI 1, implicit $x0
19  bb.0:
20    liveins: $x10
21    %10:gpr = COPY $x10
22    %20:gpr = LUI 1, implicit $x0
23    BEQ %10, %10, %bb.2
24    PseudoBR %bb.1
25  bb.1:
26    liveins: $x0
27    %30:gpr = ADDI %20, 5
28    PseudoBR %bb.3
29  bb.2:
30    PseudoBR %bb.3
31  bb.3:
32    PseudoRET
33...
34