[llvm] [AMDGPU] Check noalias.addrspace in mayAccessScratchThroughFlat (PR #151319)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 05:23:14 PDT 2025


================
@@ -4249,6 +4249,24 @@ bool SIInstrInfo::isAlwaysGDS(uint16_t Opcode) const {
          Opcode == AMDGPU::DS_SUB_GS_REG_RTN || isGWS(Opcode);
 }
 
+static bool hasNoAliasAddrSpaceScratch(const MachineMemOperand *MemOp) {
+  const MDNode *MD = MemOp->getAAInfo().NoAliasAddrSpace;
+  if (!MD)
+    return false;
+
+  // This MD is structured in ranges [A, B)
+  // Check if PRIVATE is included in any of them.
+  for (unsigned I = 0, E = MD->getNumOperands() / 2; I != E; ++I) {
----------------
Pierre-vh wrote:

Do we have any utils somewhere to parse range MD in general?
I wanted to write one but I'm unsure where it'd fit.

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


More information about the llvm-commits mailing list