[llvm] [CodeGen][AMDGPU] Allow elementwise atomic load/store at element alignment (PR #219906)

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 23:53:59 PDT 2026


================
@@ -264,23 +295,25 @@ static void copyMetadataForAtomic(Instruction &Dest,
 }
 
 template <typename Inst>
-static bool atomicSizeSupported(const TargetLowering *TLI, Inst *I) {
-  unsigned Size = getAtomicOpSize(I);
-  Align Alignment = I->getAlign();
+static bool atomicSizeSupported(const TargetLowering *TLI, const DataLayout &DL,
+                                Inst *I) {
   unsigned MaxSize = TLI->getMaxAtomicSizeInBitsSupported() / 8;
-  return Alignment >= Size && Size <= MaxSize;
+  return I->getAlign() >= getRequiredAtomicSize(TLI, DL, I) &&
----------------
harrisonGPU wrote:

Right, AtomicExpand previously required whole access alignment unconditionally, independently of the target's alignment hook.

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


More information about the llvm-commits mailing list