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

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:04:52 PDT 2026


================
@@ -398,6 +398,17 @@ unsigned GCNTTIImpl::getLoadStoreVecRegBitWidth(unsigned AddrSpace) const {
   return 128;
 }
 
+bool GCNTTIImpl::isLegalToVectorizeLoad(LoadInst *LI) const {
+  // Simple (non-atomic, non-volatile) loads are always legal.
+  if (LI->isSimple())
+    return true;
+  // Allow unordered and monotonic atomic loads to be vectorized. These
+  // orderings impose no cross address synchronization constraints, so merging
+  // adjacent accesses into a wider load is safe. The hardware guarantees
+  // atomicity for naturally aligned loads up to 128 bits.
+  return !LI->isVolatile() && !isStrongerThanMonotonic(LI->getOrdering());
----------------
eas wrote:

Does this affect other vectorizers (SLP, loop)?

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


More information about the llvm-commits mailing list