[llvm] [AMDGPU] Add support for store to constant address space (PR #153835)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 23:37:53 PDT 2025


================
@@ -1873,15 +1873,23 @@ bool SITargetLowering::isLegalAddressingMode(const DataLayout &DL,
 
 bool SITargetLowering::canMergeStoresTo(unsigned AS, EVT MemVT,
                                         const MachineFunction &MF) const {
-  if (AS == AMDGPUAS::GLOBAL_ADDRESS || AS == AMDGPUAS::FLAT_ADDRESS)
-    return (MemVT.getSizeInBits() <= 4 * 32);
-  if (AS == AMDGPUAS::PRIVATE_ADDRESS) {
+  switch (AS) {
+  default:
+    return true;
+  case AMDGPUAS::GLOBAL_ADDRESS:
+  case AMDGPUAS::FLAT_ADDRESS:
+  case AMDGPUAS::CONSTANT_ADDRESS:
+  case AMDGPUAS::CONSTANT_ADDRESS_32BIT:
+    return MemVT.getSizeInBits() <= 4 * 32;
----------------
arsenm wrote:

Is it really worth doing this optimization? I'd leave this for later anyway, we should also cover the unknown address spaces 

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


More information about the llvm-commits mailing list