[llvm] [AMDGPU] Enable volatile and non-temporal for loads to LDS (PR #153244)

Krzysztof Drewniak via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 14:47:46 PDT 2025


================
@@ -937,6 +951,43 @@ std::optional<SIMemOpInfo> SIMemOpAccess::getAtomicCmpxchgOrRmwInfo(
   return constructFromMIWithMMO(MI);
 }
 
+std::optional<std::tuple<SIMemOpInfo, SIMemOp>>
+SIMemOpAccess::getLdsLoadStoreInfo(
+    const MachineBasicBlock::iterator &MI) const {
+  assert(MI->getDesc().TSFlags & SIInstrFlags::maybeAtomic);
+
+  if (!(MI->mayLoad() && MI->mayStore()))
+    return std::nullopt;
+
+  // An LDS DMA will have exactly two memory operands.
+  if (MI->getNumMemOperands() != 2)
+    return std::nullopt;
----------------
krzysz00 wrote:

This is getting passed an arbitrary `MI`, so "having two mem operands" is part of the check for "this is a direct-to-LDS operation"

(The alternative was adding another bit to that big bitfield that has stuff like `maybeAtomic` in it, but that seemed like overkill)

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


More information about the llvm-commits mailing list