[llvm-branch-commits] [llvm] [AMDGPU] Price buffer fat pointer memory operations (PR #238842)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 6 10:48:31 PST 2026


================
@@ -2216,6 +2216,46 @@ static bool hasUniformPointerOperand(const Instruction *I,
   return isa<Constant>(Ptr);
 }
 
+static std::pair<bool, bool> getKnownBufferOobProperties(const GCNSubtarget &ST,
+                                                         const DataLayout &DL,
+                                                         const Instruction *I,
+                                                         unsigned Bytes) {
+  const Value *Ptr = I ? getLoadStorePointerOperand(I) : nullptr;
+  if (!Ptr ||
+      Ptr->getType()->getPointerAddressSpace() != AMDGPUAS::BUFFER_FAT_POINTER)
+    return {false, false};
+  APInt Offset(DL.getIndexTypeSizeInBits(Ptr->getType()), 0);
+  while (const auto *GEP = dyn_cast<GEPOperator>(Ptr)) {
+    if (!GEP->accumulateConstantOffset(DL, Offset))
----------------
krzysz00 wrote:

> Well, lowering lowering does not use the flags today, but generally speaking - you are right. I'd teach analyzeOobProperties first in a separate patch and have TTI follow.

Good point - I'll look into that when I've got a moment

(and I think it *might* be using the flags by way of scev - I'd need to check)

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


More information about the llvm-branch-commits mailing list