[llvm] [AMDGPU] Avoid referring to specific number of address spaces. NFC. (PR #137842)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 09:48:40 PDT 2025


================
@@ -540,14 +540,11 @@ enum TargetIndex {
 };
 
 static inline bool addrspacesMayAlias(unsigned AS1, unsigned AS2) {
-  static_assert(AMDGPUAS::MAX_AMDGPU_ADDRESS <= 9, "Addr space out of range");
-
   if (AS1 > AMDGPUAS::MAX_AMDGPU_ADDRESS || AS2 > AMDGPUAS::MAX_AMDGPU_ADDRESS)
     return true;
 
-  // This array is indexed by address space value enum elements 0 ... to 9
   // clang-format off
-  static const bool ASAliasRules[10][10] = {
+  static const bool ASAliasRules[][AMDGPUAS::MAX_AMDGPU_ADDRESS + 1] = {
----------------
shiltian wrote:

nit: `constexpr const`?

https://github.com/llvm/llvm-project/pull/137842


More information about the llvm-commits mailing list