[PATCH] D38621: [AArch64][GlobalISel] Make G_PHI of p0 types legal

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 8 08:31:01 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL315177: [AArch64][GlobalISel] Make G_PHI of p0 types legal. (authored by aemerson).

Changed prior to commit:
  https://reviews.llvm.org/D38621?vs=117984&id=118168#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38621

Files:
  llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
  llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-phi.mir


Index: llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
@@ -38,7 +38,7 @@
   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})
Index: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-phi.mir
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-phi.mir
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-phi.mir
@@ -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
@@ -104,6 +109,52 @@
 
 ...
 ---
+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
 alignment:       2
 exposesReturnsTwice: false


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38621.118168.patch
Type: text/x-patch
Size: 2252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171008/3ae2a9a6/attachment.bin>


More information about the llvm-commits mailing list