[PATCH] D104075: [ScalarEvolution] Merge howManyGreaterThans with howManyLessThans.

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 02:46:31 PDT 2021


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

LGTM, but I think we can remove more copy-paste (see comment). Can go as follow-up.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11534
   const SCEV *BECount;
-  if (isLoopEntryGuardedByCond(L, Cond, getMinusSCEV(Start, Stride), RHS))
-    BECount = BECountIfBackedgeTaken;
-  else {
-    // If we know that RHS >= Start in the context of loop, then we know that
-    // max(RHS, Start) = RHS at this point.
+  if (!Invert) {
+    ICmpInst::Predicate Cond =
----------------
Instead of this, can we just have smth like
```
  ICmpInst::Predicate Cond = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
  if (Invert)
    Cond = getSwappedPredicate(Cond);
```
? This piece still lppks copy-pastish.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104075/new/

https://reviews.llvm.org/D104075



More information about the llvm-commits mailing list