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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 07:25:43 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:

You could liberalize this into taking the stricter of the two though

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


More information about the llvm-commits mailing list