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

Yonah Goldberg via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 11:41:05 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;
----------------
YonahGoldberg wrote:

@arsenm I'll put up a separate PR for that. Is there anything else in this PR you need then before approval?

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


More information about the llvm-commits mailing list