[PATCH] D88087: [SCEV] Limited support for unsigned preds in isImpliedViaOperations
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 02:19:43 PDT 2020
mkazantsev added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:10158
+ const SCEV *MinusOne = getNegativeSCEV(getOne(LHS->getType()));
+ if (isImpliedCondOperands(ICmpInst::ICMP_SGT, LHS, MinusOne, FoundLHS,
+ FoundRHS) &&
----------------
mkazantsev wrote:
> reames wrote:
> > I'm confused by this check, it seems overly complicated given the comment? Why is this simply not:
> > if (isKnownNonNegative(LHS) && isKnownNonNegative(RHS) &&
> > isKnownNonNegative(FoundLHS) && isKnownNonNegative(FoundRHS)) {
> > Pred = ICmpInst::getSignedPredicate(Pred);
> > }
> Because non-negativity of LHS and RHS is not known.
We need an extra fact `SignedPred FoundLHS FoundRHS` to prove it. And we only have this fact if we know `Pred FoundLHS FoundRHS && isKnownNonNegative(FoundLHS) && isKnownNonNegative(FoundRHS)`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88087/new/
https://reviews.llvm.org/D88087
More information about the llvm-commits
mailing list