• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple=aarch64-linux-gnu -run-pass machine-cp -o - %s | FileCheck %s
2# Tests for MachineCopyPropagation copy forwarding.
3---
4# Simple forwarding.
5# CHECK-LABEL: name: test1
6# CHECK: $x0 = SUBXri $x0, 1, 0
7name:            test1
8tracksRegLiveness: true
9body: |
10  bb.0:
11    liveins: $x0
12    renamable $x1 = COPY $x0
13    $x0 = SUBXri renamable $x1, 1, 0
14...
15---
16# Don't forward if not renamable.
17# CHECK-LABEL: name: test2
18# CHECK: $x0 = SUBXri $x1, 1, 0
19name:            test2
20tracksRegLiveness: true
21body: |
22  bb.0:
23    liveins: $x0
24    $x1 = COPY $x0
25    $x0 = SUBXri $x1, 1, 0
26...
27---
28# Don't forward reserved non-constant reg values.
29# CHECK-LABEL: name: test4
30# CHECK: $x0 = SUBXri renamable $x1, 1, 0
31name:            test4
32tracksRegLiveness: true
33body: |
34  bb.0:
35    liveins: $x0
36    $sp = SUBXri $sp, 16, 0
37    renamable $x1 = COPY $sp
38    $x0 = SUBXri renamable $x1, 1, 0
39    $sp = ADDXri $sp, 16, 0
40...
41---
42# Don't violate opcode constraints when forwarding.
43# CHECK-LABEL: name: test5
44# CHECK: $x0 = SUBXri renamable $x1, 1, 0
45name:            test5
46tracksRegLiveness: true
47body: |
48  bb.0:
49    liveins: $x0
50    renamable $x1 = COPY $xzr
51    $x0 = SUBXri renamable $x1, 1, 0
52...
53---
54# Test cross-class COPY forwarding.
55# CHECK-LABEL: name: test6
56# CHECK: $x2 = COPY $x0
57name:            test6
58tracksRegLiveness: true
59body: |
60  bb.0:
61    liveins: $x0
62    renamable $d1 = COPY $x0
63    $x2 = COPY renamable $d1
64    RET_ReallyLR implicit $x2
65...
66---
67# Don't forward if there are overlapping implicit operands.
68# CHECK-LABEL: name: test7
69# CHECK: $w0 = SUBWri killed renamable $w1, 1, 0
70name:            test7
71tracksRegLiveness: true
72body: |
73  bb.0:
74    liveins: $w0
75    renamable $w1 = COPY $w0
76    $w0 = SUBWri killed renamable $w1, 1, 0, implicit killed $x1
77...
78---
79# Check that kill flags are cleared.
80# CHECK-LABEL: name: test8
81# CHECK: $x2 = ADDXri $x0, 1, 0
82# CHECK: $x0 = SUBXri $x0, 1, 0
83name:            test8
84tracksRegLiveness: true
85body: |
86  bb.0:
87    liveins: $x0
88    renamable $x1 = COPY $x0
89    $x2 = ADDXri killed $x0, 1, 0
90    $x0 = SUBXri renamable $x1, 1, 0
91...
92---
93# Don't forward if value is clobbered.
94# CHECK-LABEL: name: test9
95# CHECK: $x2 = SUBXri renamable $x1, 1, 0
96name:            test9
97tracksRegLiveness: true
98body: |
99  bb.0:
100    liveins: $x0
101    renamable $x1 = COPY $x0
102    $x0 = ADDXri $x0, 1, 0
103    $x2 = SUBXri renamable $x1, 1, 0
104...
105