[llvm] [IR] Add elementwise modifier to atomic loads (PR #204556)

Yonah Goldberg via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 14:50:33 PDT 2026


================
@@ -4532,15 +4783,29 @@ void Verifier::visitLoadInst(LoadInst &LI) {
     Check(LI.getOrdering() != AtomicOrdering::Release &&
               LI.getOrdering() != AtomicOrdering::AcquireRelease,
           "Load cannot have Release ordering", &LI);
-    Check(ElTy->getScalarType()->isIntOrPtrTy() ||
-              ElTy->getScalarType()->isByteTy() ||
-              ElTy->getScalarType()->isFloatingPointTy(),
+
+    Type *ScalarTy = ElTy;
+    if (LI.isElementwise()) {
+      auto *VecTy = dyn_cast<FixedVectorType>(ElTy);
+      Check(VecTy,
+            "atomic elementwise load operand must have fixed vector type!", &LI,
+            ElTy);
+      if (VecTy) {
+        checkAtomicMemAccessSize(ScalarTy, &LI);
+        ScalarTy = VecTy->getElementType();
+      }
+    }
+
+    Check(ScalarTy->getScalarType()->isIntOrPtrTy() ||
----------------
YonahGoldberg wrote:

Oh I see these are the restrictions on the scalar type, makes sense.

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


More information about the llvm-commits mailing list