[PATCH] D51843: AMDGPU: Don't error on out of bounds address spaces

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 9 18:45:25 PDT 2018


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

We should never abort on valid IR. The most reasonable
interpretation of an arbitrary address space pointer is
probably some kind of special subset of global memory.


https://reviews.llvm.org/D51843

Files:
  lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
  test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll


Index: test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
===================================================================
--- test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
+++ test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
@@ -31,3 +31,22 @@
   ret void
 }
 
+; CHECK: MayAlias:	i8 addrspace(999)* %p0, i8* %p
+define void @test_0_999(i8 addrspace(0)* %p, i8 addrspace(999)* %p0) {
+  ret void
+}
+
+; CHECK: MayAlias:	i8 addrspace(999)* %p, i8* %p1
+define void @test_999_0(i8 addrspace(999)* %p, i8 addrspace(0)* %p1) {
+  ret void
+}
+
+; CHECK: MayAlias:	i8 addrspace(1)* %p, i8 addrspace(999)* %p1
+define void @test_1_999(i8 addrspace(1)* %p, i8 addrspace(999)* %p1) {
+  ret void
+}
+
+; CHECK: MayAlias:	i8 addrspace(1)* %p1, i8 addrspace(999)* %p
+define void @test_999_1(i8 addrspace(999)* %p, i8 addrspace(1)* %p1) {
+  ret void
+}
Index: lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+++ lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
@@ -76,12 +76,8 @@
 
   static_assert(AMDGPUAS::MAX_AMDGPU_ADDRESS <= 6, "Addr space out of range");
 
-
-  if (AS1 > AMDGPUAS::MAX_AMDGPU_ADDRESS || AS2 > AMDGPUAS::MAX_AMDGPU_ADDRESS) {
-    if (Arch == Triple::amdgcn)
-      report_fatal_error("Pointer address space out of range");
-    return AS1 == AS2 ? MayAlias : NoAlias;
-  }
+  if (AS1 > AMDGPUAS::MAX_AMDGPU_ADDRESS || AS2 > AMDGPUAS::MAX_AMDGPU_ADDRESS)
+    return MayAlias;
 
   return ASAliasRules[AS1][AS2];
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51843.164594.patch
Type: text/x-patch
Size: 1525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180910/edaa2e70/attachment.bin>


More information about the llvm-commits mailing list