[PATCH] D129753: [SCEV] Prove condition invariance via context
Artur Pilipenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 22:34:13 PDT 2022
apilipenko added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:10815-10829
+ assert(ArLHS->hasNoUnsignedWrap() && "Is a requirement of monotonicity!");
+ // If we can prove that ArLHS <s RHS, and RHS >=s 0, and we know that ArLHS
+ // does not cross zero, there are two options:
+ // - ArLHS is always negative. It means that ArLHS <u RHS is always false;
+ // - ArLHS is always non-negative. It means that
+ // ArLHS <s RHS <=> ArLHS <u RHS.
+ // We are guarded by ArLHS <s RHS, so unsigned condition is trivially
----------------
Suggested slight rewording of the reasoning and restructuring of the code.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:10824
+ // All together it means that ArLHS <u RHS <=> Start(ArLHS) >=s 0.
+ // We can strenthen this to Start(ArLHS <u RHS).
+ auto SignFlippedPred = ICmpInst::getFlippedSignednessPredicate(Pred);
----------------
Why don't you use Start(ArLHS) >=s 0 as the resulting invariant condition?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129753/new/
https://reviews.llvm.org/D129753
More information about the llvm-commits
mailing list