[llvm] [IR][AtomicExpand] Add elementwise modifier to atomicrmw; automatically expand for all targets (PR #189517)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 03:13:04 PDT 2026


================
@@ -265,6 +268,23 @@ static bool atomicSizeSupported(const TargetLowering *TLI, Inst *I) {
          Size <= TLI->getMaxAtomicSizeInBitsSupported() / 8;
 }
 
+/// Returns true if we can lower atomicrmw elementwise using normal atomicrmw.
+bool AtomicExpandImpl::canReuseWholeValueAtomicRMW(AtomicRMWInst *AI) {
+  assert(AI->isElementwise() && "expected elementwise atomicrmw");
+
+  // Integer non-elementwise vector atomicrmw is illegal IR, so we need to be
+  // careful to reject these before removing the elementwise modifier.
+  if (!AI->isFloatingPointOperation())
+    return false;
----------------
arsenm wrote:

Hm, I thought that was fixed? It doesn't really make sense to only support this for the elementwise case, but I suppose that's a separate issue 

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


More information about the llvm-commits mailing list