[PATCH] D51793: AMDGPU: Stop reporting is-noop addrspacecast for constant 32-bit

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 7 08:28:24 PDT 2018


arsenm created this revision.
arsenm added reviewers: nhaehnle, mareko.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, wdng, jvesely, kzhuravl.

This will require something to cast. Before this would eliminate
the cast, which would result in copies of $noreg.


https://reviews.llvm.org/D51793

Files:
  lib/Target/AMDGPU/SIISelLowering.cpp
  test/CodeGen/AMDGPU/invalid-addrspacecast.ll


Index: test/CodeGen/AMDGPU/invalid-addrspacecast.ll
===================================================================
--- test/CodeGen/AMDGPU/invalid-addrspacecast.ll
+++ test/CodeGen/AMDGPU/invalid-addrspacecast.ll
@@ -6,3 +6,10 @@
   store volatile i32 0, i32 addrspace(1)* %stof
   ret void
 }
+
+; ERROR: error: <unknown>:0:0: in function use_constant32bit_to_flat_addrspacecast void (i32 addrspace(6)*): invalid addrspacecast
+define amdgpu_kernel void @use_constant32bit_to_flat_addrspacecast(i32 addrspace(6)* %ptr) #0 {
+  %stof = addrspacecast i32 addrspace(6)* %ptr to i32*
+  store volatile i32 7, i32* %stof
+  ret void
+}
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1123,8 +1123,7 @@
 static bool isFlatGlobalAddrSpace(unsigned AS) {
   return AS == AMDGPUAS::GLOBAL_ADDRESS ||
          AS == AMDGPUAS::FLAT_ADDRESS ||
-         AS == AMDGPUAS::CONSTANT_ADDRESS ||
-         AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT;
+         AS == AMDGPUAS::CONSTANT_ADDRESS;
 }
 
 bool SITargetLowering::isNoopAddrSpaceCast(unsigned SrcAS,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51793.164432.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/e4511130/attachment.bin>


More information about the llvm-commits mailing list