[PATCH] D87832: [IndVars] Remove monotonic checks with unknown exit count

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 13:39:07 PDT 2020


apilipenko added a comment.

Still digging through the main logic. In the meantime see some minor comments inline.



================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:956
+  /// of LHS `Pred` RHS.
+  bool isLoopInvariantPredicateAtDuringFirstIterations(
+      ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Loop *L,
----------------
Style. Suggest to drop At from the name so as to make it more readable `isLoopInvariantPredicateDuringFirstIterations`.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2358
   // Can we prove it to be trivially true?
-  if (SE->isKnownPredicate(Pred, LHSS, RHSS))
+  if (SE->isKnownPredicateAt(Pred, LHSS, RHSS, BI))
     return true;
----------------
Looks like a separable enhancement.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2452-2465
+      auto *BI = cast<BranchInst>(ExitingBB->getTerminator());
+      auto OptimizeCond = [&](bool Inverted, const SCEV *MaxIter) {
+        if (isTrivialCond(L, BI, SE, Inverted, MaxIter)) {
+          FoldExit(ExitingBB, Inverted);
+          return true;
+        }
+        return false;
----------------
Separable refactoring?


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

https://reviews.llvm.org/D87832



More information about the llvm-commits mailing list