[PATCH] D30887: [ScalarEvolution] Predicate implication from operations

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 20:31:01 PDT 2017


mkazantsev added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:8501
+  if (Pred == ICmpInst::ICMP_SLT)
+    return isImpliedViaOperations(ICmpInst::ICMP_SGT, RHS, LHS, FoundRHS,
+                                  FoundLHS);
----------------
sanjoy wrote:
> The usual way to do this is
> 
> ```
> if (Pred == ICmpInst::ICMP_SLT) {
>   Pred = ICmpInst::ICMP_SGT;
>   std::swap(LHS, RHS);
>   std::swap(FoundLHS, FoundRHS);
> }
> ```
> 
> Actually, you should not need to do this. `ScalarEvolution::isImpliedCond` should be handling this case for you.
I will check this. If you are right, checking "less" cases in switch of ScalarEvolution::isImpliedCondOperandsHelper seems redundant.


https://reviews.llvm.org/D30887





More information about the llvm-commits mailing list