[PATCH] D88210: [IndVars] Use knowledge about execution on last iteration when removing checks

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 07:22:12 PDT 2020


ebrevnov added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2313
+                          bool ProvingLoopExit, const SCEV *MaxIter,
+                          bool SkipLastIter) {
   ICmpInst::Predicate Pred;
----------------
I think we better avoid adding SkipLastIter parameter since we should be able to cover all cases with existing MaxIter  and it just unnecessarily complicates the API.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2345
 
+  if (SkipLastIter) {
+    const SCEV *One = SE->getOne(MaxIter->getType());
----------------
Let's move this to the caller.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2473
+      // executed 1 iteration less.
+      SkipLastIter = true;
+
----------------
I suggest to adjust MaxIter here. It should greatly simplify the logic in this loop.


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

https://reviews.llvm.org/D88210



More information about the llvm-commits mailing list