[llvm] [AtomicExpand] Add elementwise expansion (PR #196464)

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 03:17:02 PDT 2026


================
@@ -382,30 +385,41 @@ bool AtomicExpandImpl::processAtomicInstr(Instruction *I) {
   }
 
   if (auto *RMWI = dyn_cast<AtomicRMWInst>(I)) {
+    bool IsElementwiseExpand =
+        RMWI->isElementwise() &&
+        TLI->shouldExpandAtomicRMWInIR(RMWI) ==
+            TargetLoweringBase::AtomicExpansionKind::Expand;
+
     if (!atomicSizeSupported(TLI, RMWI)) {
----------------
harrisonGPU wrote:

Could we handle this in atomicSizeSupported() instead? For an elementwise atomicrmw, it could check the size and alignment of the element type rather than those of the entire vector.

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


More information about the llvm-commits mailing list