[llvm] [LSV][AMDGPU] Vectorize unordered and monotonic atomic loads (PR #190152)
Harrison Hao via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 04:39:47 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());
+ }
----------------
harrisonGPU wrote:
We don't need to check stricter, because all elements in a chain are guaranteed to have the same ordering and scope because `EqClassKey` partitions on both `AtomicOrdering` and `SyncScopeID`.
https://github.com/llvm/llvm-project/pull/190152
More information about the llvm-commits
mailing list