[llvm] [Loads] Support dereferenceable assumption with variable size. (PR #128436)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 08:19:09 PDT 2025


================
@@ -339,9 +347,11 @@ bool llvm::isDereferenceableAndAlignedInLoop(
 
   Value *Base = nullptr;
   APInt AccessSize;
+  const SCEV *AccessSizeSCEV = nullptr;
   if (const SCEVUnknown *NewBase = dyn_cast<SCEVUnknown>(AccessStart)) {
     Base = NewBase->getValue();
     AccessSize = MaxPtrDiff;
+    AccessSizeSCEV = PtrDiff;
   } else if (auto *MinAdd = dyn_cast<SCEVAddExpr>(AccessStart)) {
----------------
preames wrote:

OT - We may be able to strengthen this code using SCEV's getPointerBase and removePointerBase.  

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


More information about the llvm-commits mailing list