diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2018-08-20 13:18:59 +0000 |
---|---|---|
committer | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2018-08-20 13:18:59 +0000 |
commit | c95ef77d37152fe0e1fc8dbf0dec7fb35ee2928f (patch) | |
tree | 8330f52169592ce459218e4f8eb9df216f8a910f | |
parent | 54829bb3ff750cf8061fcd82db46f3596fa9cbac (diff) | |
download | bcm5719-llvm-c95ef77d37152fe0e1fc8dbf0dec7fb35ee2928f.tar.gz bcm5719-llvm-c95ef77d37152fe0e1fc8dbf0dec7fb35ee2928f.zip |
AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space
32-bit constant address space is declared as 6, so the
maximum number of address spaces is 6, not 5.
Fixes "LLVM ERROR: Pointer address space out of range".
v3: use static_assert()
v2: add a very simple test for 32-bit addr space
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106630
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
llvm-svn: 340171
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPU.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll | 6 |
3 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h index 796766d9462..26580a86747 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.h +++ b/llvm/lib/Target/AMDGPU/AMDGPU.h @@ -229,7 +229,7 @@ struct AMDGPUAS { enum : unsigned { // The maximum value for flat, generic, local, private, constant and region. - MAX_COMMON_ADDRESS = 5, + MAX_COMMON_ADDRESS = 6, GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0). CONSTANT_ADDRESS = 4, ///< Address space for constant memory (VTX2) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp index ef4b69d09d9..717d8a17ca8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp @@ -69,7 +69,7 @@ AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_, Triple::ArchType Ar /* Region */ {MayAlias, NoAlias , NoAlias , NoAlias, MayAlias, NoAlias}, /* Private */ {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias} }; - assert(AS.MAX_COMMON_ADDRESS <= 5); + static_assert(AS.MAX_COMMON_ADDRESS <= 6, "Addr space out of range"); if (AS.FLAT_ADDRESS == 0) { assert(AS.GLOBAL_ADDRESS == 1 && AS.REGION_ADDRESS == 2 && diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll index 51d96498c53..72442e2d7d2 100644 --- a/llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll +++ b/llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll @@ -7,3 +7,9 @@ define void @test(i8 addrspace(5)* %p, i8 addrspace(1)* %p1) { ret void } +; CHECK: NoAlias: i8 addrspace(1)* %p1, i8 addrspace(6)* %p + +define void @test_32bit_addr_space(i8 addrspace(6)* %p, i8 addrspace(1)* %p1) { + ret void +} + |