[PATCH] D87890: [SCEV] Handle `less` predicates for FoundPred = NE
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 01:47:49 PDT 2020
mkazantsev created this revision.
mkazantsev added reviewers: fhahn, asbirlea, lebedev.ri.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
mkazantsev requested review of this revision.
Currently these predicates are ignored, yet their handling is
pretty simple. I could not find a single test where it would
actually change something, but it's only because isImpliedCondOperands
is not smart enough to prove it further on. Yet the situation when
we come there with `less` predicate is pretty common.
https://reviews.llvm.org/D87890
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9720,8 +9720,23 @@
if (isImpliedCondOperands(Pred, LHS, RHS, V, getConstant(Min)))
return true;
+ break;
+
+ // `LHS < RHS` is handled in the same way as `RHS > LHS`.
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_ULE:
+ if (isImpliedCondOperands(CmpInst::getSwappedPredicate(Pred), RHS,
+ LHS, V, getConstant(SharperMin)))
+ return true;
LLVM_FALLTHROUGH;
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_ULT:
+ if (isImpliedCondOperands(CmpInst::getSwappedPredicate(Pred), RHS,
+ LHS, V, getConstant(Min)))
+ return true;
+ break;
+
default:
// No change
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87890.292721.patch
Type: text/x-patch
Size: 1000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/5689aa5e/attachment.bin>
More information about the llvm-commits
mailing list