[llvm] [AMDGPU] Enable volatile and non-temporal for loads to LDS (PR #153244)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 06:01:36 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;
+
+ bool HasLDS = false;
+ bool HasNonLDS = false;
+ SIMemOp OpKind = SIMemOp::LOAD;
+ for (const auto &MMO : MI->memoperands()) {
+ unsigned AS = MMO->getAddrSpace();
+ HasLDS |= AS == AMDGPUAS::LOCAL_ADDRESS;
+ if (AS != AMDGPUAS::LOCAL_ADDRESS) {
+ HasNonLDS |= true;
+ if (!HasLDS) {
+ // If the pointer to LDS was in the first memop, this is a store
+ // from that pointer.
+ OpKind = SIMemOp::STORE;
+ }
+ }
+ }
+ if (!HasLDS || !HasNonLDS) {
+ return std::nullopt;
+ }
+
+ if (auto MOI = constructFromMIWithMMO(MI)) {
+ return std::make_tuple(*MOI, OpKind);
----------------
arsenm wrote:
```suggestion
return {*MOI, OpKind};
```
https://github.com/llvm/llvm-project/pull/153244
More information about the llvm-commits
mailing list