localizer-in-O0-pipeline.mir
3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# RUN: llc -O0 -mtriple aarch64-apple-ios %s -global-isel -start-after regbankselect \
# RUN: -stop-before instruction-select -o - | FileCheck --check-prefix=CHECK --check-prefix=OPTNONE %s
# RUN: llc -mtriple aarch64-apple-ios %s -global-isel -start-after regbankselect \
# RUN: -stop-before instruction-select -o - | FileCheck --check-prefix=CHECK --check-prefix=OPT %s
#
# Check that we are only running the localizer at O0 and that it runs
# between the regbankselect pass and the instruction-select.
# Moreover, check that it does what we expect.
--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-apple-ios"
define float @foo(float %arg, i1 %cond) {
br i1 %cond, label %true, label %false
true: ; preds = %0
br label %end
false: ; preds = %0
br label %end
end: ; preds = %false, %true
%val = phi float [ 1.000000e+00, %true ], [ 2.000000e+00, %false ]
%res = fadd float %arg, %val
ret float %res
}
...
---
# CHECK-LABEL: name: foo
name: foo
alignment: 4
legalized: true
regBankSelected: true
tracksRegLiveness: true
registers:
# CHECK: registers:
# CHECK-NEXT: - { id: 0, class: fpr, preferred-register: '' }
# CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
# CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
# CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
# CHECK-NEXT: - { id: 4, class: fpr, preferred-register: '' }
# CHECK-NEXT: - { id: 5, class: fpr, preferred-register: '' }
# CHECK-NEXT: - { id: 6, class: gpr, preferred-register: '' }
# The localizer will create two new values to materialize the constants.
# OPTNONE-NEXT: - { id: 7, class: fpr, preferred-register: '' }
# OPTNONE-NEXT: - { id: 8, class: fpr, preferred-register: '' }
- { id: 0, class: fpr }
- { id: 1, class: gpr }
- { id: 2, class: fpr }
- { id: 3, class: fpr }
- { id: 4, class: fpr }
- { id: 5, class: fpr }
- { id: 6, class: gpr }
# First block remains untouched
# CHECK: body
# CHECK: %4:fpr(s32) = G_FCONSTANT float 1.000000e+00
# CHECK: %5:fpr(s32) = G_FCONSTANT float 2.000000e+00
# Second block will get the constant 1.0 when the localizer is enabled.
# CHECK: bb.1.{{[a-zA-Z0-9]+}}:
# OPT: [[FONE:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 1.000000e+00
# OPTNONE: [[FONE:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 1.000000e+00
# CHECK: G_BR %bb.3
# Thrid block will get the constant 2.0 when the localizer is enabled.
# CHECK: bb.2.{{[a-zA-Z0-9]+}}:
# OPT: [[FTWO:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 2.000000e+00
# OPTNONE: [[FTWO:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 2.000000e+00
# CHECK: bb.3.end
# OPTNONE: %2:fpr(s32) = PHI [[FONE]](s32), %bb.1, [[FTWO]](s32), %bb.2
# OPT: %2:fpr(s32) = PHI [[FONE]](s32), %bb.1, [[FTWO]](s32), %bb.2
# CHECK-NEXT: G_FADD %0, %2
body: |
bb.0 (%ir-block.0):
liveins: $s0, $w0
%0(s32) = COPY $s0
%6(s32) = COPY $w0
%1(s1) = G_TRUNC %6
%4(s32) = G_FCONSTANT float 1.000000e+00
%5(s32) = G_FCONSTANT float 2.000000e+00
G_BRCOND %1(s1), %bb.1
G_BR %bb.2
bb.1.true:
G_BR %bb.3
bb.2.false:
bb.3.end:
%2(s32) = PHI %4(s32), %bb.1, %5(s32), %bb.2
%3(s32) = G_FADD %0, %2
$s0 = COPY %3(s32)
RET_ReallyLR implicit $s0
...