[llvm] r196269 - Addrspacecasts are no-ops on ARM.

James Molloy james.molloy at arm.com
Tue Dec 3 03:23:11 PST 2013


Author: jamesm
Date: Tue Dec  3 05:23:11 2013
New Revision: 196269

URL: http://llvm.org/viewvc/llvm-project?rev=196269&view=rev
Log:
Addrspacecasts are no-ops on ARM.

Testcase added.


Added:
    llvm/trunk/test/CodeGen/ARM/addrspacecast.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.h

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=196269&r1=196268&r2=196269&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Dec  3 05:23:11 2013
@@ -361,6 +361,12 @@ namespace llvm {
     /// be used for loads / stores from the global.
     virtual unsigned getMaximalGlobalOffset() const;
 
+    /// Returns true if a cast between SrcAS and DestAS is a noop.
+    virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const {
+      // Addrspacecasts are always noops.
+      return true;
+    }
+
     /// createFastISel - This method returns a target specific FastISel object,
     /// or null if the target does not support "fast" ISel.
     virtual FastISel *createFastISel(FunctionLoweringInfo &funcInfo,

Added: llvm/trunk/test/CodeGen/ARM/addrspacecast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/addrspacecast.ll?rev=196269&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/addrspacecast.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/addrspacecast.ll Tue Dec  3 05:23:11 2013
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=arm
+
+; Check that codegen for an addrspace cast succeeds without error.
+define <4 x i32 addrspace(1)*> @f (<4 x i32*> %x) {
+  %1 = addrspacecast <4 x i32*> %x to <4 x i32 addrspace(1)*>
+  ret <4 x i32 addrspace(1)*> %1
+}





More information about the llvm-commits mailing list