1# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-sink -o - %s | FileCheck %s
2--- |
3  define void @sinkwzr() { ret void }
4...
5---
6name:            sinkwzr
7tracksRegLiveness: true
8registers:
9  - { id: 0, class: gpr32 }
10  - { id: 1, class: gpr32 }
11  - { id: 2, class: gpr32sp }
12  - { id: 3, class: gpr32 }
13  - { id: 4, class: gpr32 }
14body:             |
15  ; Check that WZR copy is sunk into the loop preheader.
16  ; CHECK-LABEL: name: sinkwzr
17  ; CHECK-LABEL: bb.0:
18  ; CHECK-NOT: COPY $wzr
19  bb.0:
20    liveins: $w0
21
22    %0 = COPY $w0
23    %1 = COPY $wzr
24    CBZW %0, %bb.3
25
26  ; CHECK-LABEL: bb.1:
27  ; CHECK: COPY $wzr
28
29  bb.1:
30    B %bb.2
31
32  bb.2:
33    %2 = PHI %0, %bb.1, %4, %bb.2
34    $w0 = COPY %1
35    %3 = SUBSWri %2, 1, 0, implicit-def dead $nzcv
36    %4 = COPY %3
37    CBZW %3, %bb.3
38    B %bb.2
39
40  bb.3:
41    RET_ReallyLR
42
43...
44