[llvm] [LAA] Honor no-wrap predicates already in PSE in isNoWrap (PR #226430)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 02:44:55 PDT 2026
================
@@ -1153,7 +1153,12 @@ isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR, Value *Ptr,
return true;
}
- return false;
+ // Without adding a new predicate, AR may still be known not to wrap if the
+ // predicates of PSE already imply it, e.g. because a wrap predicate for AR
+ // was added while analyzing the dependences of the loop.
+ ScalarEvolution &SE = *PSE.getSE();
+ return PSE.getPredicate().implies(
+ SE.getWrapPredicate(AR, SCEVWrapPredicate::IncrementNUSW), SE);
----------------
artagnon wrote:
It was interesting to see why the suggestion wouldn't hold: normally, adding predicates to PSE will automatically run implies to eliminate redundant predicates, so my suggestion should have been non-functional, but I wanted to find out why there were test changes -- thanks for the explanation, makes sense now!
https://github.com/llvm/llvm-project/pull/226430
More information about the llvm-commits
mailing list