[llvm] [LAA,Loads] Use loop guards and max BTC if needed when checking deref. (PR #155672)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 15:28:11 PDT 2025
================
@@ -263,23 +260,36 @@ evaluatePtrAddRecAtMaxBTCWillNotWrap(const SCEVAddRecExpr *AR,
SE.getMinusSCEV(AR->getStart(), StartPtr), WiderTy);
const SCEV *OffsetAtLastIter =
- mulSCEVOverflow(MaxBTC, SE.getAbsExpr(Step, /*IsNSW=*/false), SE, CtxI);
- if (!OffsetAtLastIter)
- return false;
+ mulSCEVOverflow(MaxBTC, SE.getAbsExpr(Step, /*IsNSW=*/false), SE);
+ if (!OffsetAtLastIter) {
+ // Re-try with constant max backedge-taken count if using the symbolic one
+ // failed.
+ MaxBTC = SE.getNoopOrZeroExtend(
+ SE.getConstantMaxBackedgeTakenCount(AR->getLoop()), WiderTy);
+ OffsetAtLastIter =
+ mulSCEVOverflow(MaxBTC, SE.getAbsExpr(Step, /*IsNSW=*/false), SE);
----------------
annamthomas wrote:
why not use the CtxI above as done previously? Would that along with the mulSCEVOverflow change allow to get whats needed?
https://github.com/llvm/llvm-project/pull/155672
More information about the llvm-commits
mailing list