[llvm] [LSV][AMDGPU] Vectorize unordered and monotonic atomic loads (PR #190152)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:10:40 PDT 2026


================
@@ -1159,6 +1166,12 @@ bool Vectorizer::vectorizeChain(Chain &C) {
       // i.e. the root of the vector.
       VecInst = Builder.CreateAlignedLoad(
           VecTy, getLoadStorePointerOperand(C[0].Inst), Alignment);
+      // Preserve atomic ordering and syncscope on the merged load.
+      auto *OrigLI = cast<LoadInst>(C[0].Inst);
+      if (OrigLI->isAtomic()) {
+        cast<LoadInst>(VecInst)->setOrdering(OrigLI->getOrdering());
+        cast<LoadInst>(VecInst)->setSyncScopeID(OrigLI->getSyncScopeID());
+      }
----------------
arsenm wrote:

Shouldn't this call some function to get the stricter of the 2 orderings and scope?

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


More information about the llvm-commits mailing list