[llvm] [AMDGPU] Check noalias.addrspace in mayAccessScratchThroughFlat (PR #151319)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 02:47:44 PDT 2025
================
@@ -1630,6 +1631,22 @@ getIntegerVecAttribute(const Function &F, StringRef Name, unsigned Size) {
return Vals;
}
+bool hasValueInRange(const MDNode *MD, unsigned Val) {
+ if (!MD)
+ return false;
+
+ assert((MD->getNumOperands() % 2 == 0) && "invalid number of operands!");
+ for (unsigned I = 0, E = MD->getNumOperands() / 2; I != E; ++I) {
+ auto *Low = mdconst::extract<ConstantInt>(MD->getOperand(2 * I + 0));
+ auto *High = mdconst::extract<ConstantInt>(MD->getOperand(2 * I + 1));
+ assert(Low->getValue().ult(High->getValue()) && "invalid range metadata!");
----------------
Pierre-vh wrote:
@arsenm There is a test that has a "wrapped" range: llvm/test/Transforms/AtomicExpand/AMDGPU/expand-cmpxchg-flat-maybe-private.ll
`noalias.addrspace` there has a value of `[6;5)`.
I guess this is a different way to say "everything is noalias except private" ?
If so then I need to replace that assert with a if/else to handle such ranges
https://github.com/llvm/llvm-project/pull/151319
More information about the llvm-commits
mailing list