[AArch64][GlobalISel] Make G_PHI of p0 types legal.

Differential Revision: https://reviews.llvm.org/D38621

llvm-svn: 315177
This commit is contained in:
Amara Emerson 2017-10-08 15:29:11 +00:00
parent 6410ca70aa
commit 1cd89ca669
2 changed files with 52 additions and 1 deletions

View File

@ -38,7 +38,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo() {
for (auto Ty : {p0, s1, s8, s16, s32, s64})
setAction({G_IMPLICIT_DEF, Ty}, Legal);
for (auto Ty : {s16, s32, s64})
for (auto Ty : {s16, s32, s64, p0})
setAction({G_PHI, Ty}, Legal);
for (auto Ty : {s1, s8})

View File

@ -10,6 +10,11 @@
ret i32 0
}
define i64* @legalize_phi_ptr(i64* %a, i64* %b, i1 %cond) {
entry:
ret i64* null
}
define i32 @legalize_phi_empty(i32 %argc) {
entry:
ret i32 0
@ -102,6 +107,52 @@ body: |
%w0 = COPY %10(s32)
RET_ReallyLR implicit %w0
...
---
name: legalize_phi_ptr
alignment: 2
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
tracksRegLiveness: true
registers:
- { id: 0, class: _, preferred-register: '' }
- { id: 1, class: _, preferred-register: '' }
- { id: 2, class: _, preferred-register: '' }
- { id: 3, class: _, preferred-register: '' }
- { id: 4, class: _, preferred-register: '' }
- { id: 5, class: _, preferred-register: '' }
liveins:
body: |
bb.1:
; CHECK-LABEL: name: legalize_phi_ptr
; CHECK-LABEL: bb.0:
; CHECK: %0(p0) = COPY %x0
; CHECK: %1(p0) = COPY %x1
; CHECK: %2(s1) = COPY %w2
; CHECK-LABEL: bb.1:
; CHECK-LABEL: bb.2:
; CHECK: %3(p0) = G_PHI %0(p0), %bb.0, %1(p0), %bb.1
; CHECK: %x0 = COPY %3(p0)
successors: %bb.2, %bb.3
liveins: %w2, %x0, %x1
%0(p0) = COPY %x0
%1(p0) = COPY %x1
%2(s1) = COPY %w2
G_BRCOND %2(s1), %bb.2
G_BR %bb.3
bb.2:
successors: %bb.3
bb.3:
%3(p0) = G_PHI %0(p0), %bb.1, %1(p0), %bb.2
%x0 = COPY %3(p0)
RET_ReallyLR implicit %x0
...
---
name: legalize_phi_empty