GlobalISel: allow G_GLOBAL_VALUEs in AArch64 legalization.
authorTim Northover <tnorthover@apple.com>
Mon, 10 Oct 2016 21:49:53 +0000 (21:49 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 10 Oct 2016 21:49:53 +0000 (21:49 +0000)
llvm-svn: 283808

llvm/lib/Target/AArch64/AArch64MachineLegalizer.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir

index 653c7d5..f35fd35 100644 (file)
@@ -168,6 +168,7 @@ AArch64MachineLegalizer::AArch64MachineLegalizer() {
 
   // Pointer-handling
   setAction({G_FRAME_INDEX, p0}, Legal);
+  setAction({G_GLOBAL_VALUE, p0}, Legal);
 
   setAction({G_PTRTOINT, 0, s64}, Legal);
   setAction({G_PTRTOINT, 1, p0}, Legal);
index 5fa751a..74a82e2 100644 (file)
@@ -11,6 +11,8 @@
   entry:
     ret void
   }
+  @var = global i8 0
+  define i8* @test_global() { ret i8* undef }
 ...
 
 ---
@@ -61,3 +63,15 @@ body: |
     %1(s64) = G_FCONSTANT double 2.0
     %2(s16) = G_FCONSTANT half 0.0
 ...
+
+---
+name:            test_global
+registers:
+  - { id: 0, class: _ }
+body: |
+  bb.0:
+    ; CHECK-LABEL: name: test_global
+    ; CHECK: %0(p0) = G_GLOBAL_VALUE @var
+
+    %0(p0) = G_GLOBAL_VALUE @var
+...