[llvm] LAA: strip unit-stride check in getPtrStride (PR #122879)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 04:13:23 PST 2025
================
@@ -1520,12 +1520,11 @@ llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr,
GEP && GEP->hasNoUnsignedSignedWrap())
return Stride;
- // If the null pointer is undefined, then a access sequence which would
- // otherwise access it can be assumed not to unsigned wrap. Note that this
- // assumes the object in memory is aligned to the natural alignment.
+ // If the null pointer dereference is undefined, then a access sequence which
+ // would otherwise access it can be assumed not to unsigned wrap. Note that
+ // this assumes the object in memory is aligned to the natural alignment.
unsigned AddrSpace = Ty->getPointerAddressSpace();
- if (!NullPointerIsDefined(Lp->getHeader()->getParent(), AddrSpace) &&
- (Stride == 1 || Stride == -1))
+ if (!NullPointerIsDefined(Lp->getHeader()->getParent(), AddrSpace))
----------------
fhahn wrote:
I am not sure we can apply the same reasoning as for a353e25 here.
If the stride is != 1,-1, we could wrap but never reach null I think
https://github.com/llvm/llvm-project/pull/122879
More information about the llvm-commits
mailing list