[PATCH] D43375: [SCEV] Prove predicates in loops via monotonicity

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 22:48:02 PST 2018


mkazantsev added inline comments.


================
Comment at: test/Transforms/IndVarSimplify/prove_via_monotonicity.ll:19
+  %len.minus.1 = add nsw i32 %len, -1
+  %zero_check = icmp eq i32 %len, 0
+  br i1 %zero_check, label %loopexit, label %preheader
----------------
sanjoy wrote:
> I think we can optimize these cases without thinking about monotonicity -- in both `@test_01` and `@test_02` to widen the IV you need to prove that *if* the backedge is taken *then* `%iv` is not `0`; and SCEV should be able to prove that easily from the BE condition.
It looks like `isImpliedCondOperandsViaNoOverflow` could have done that, but it doesn't currently support `sgt` predicate (which is weird). I will try to come up with alternative solution there.


https://reviews.llvm.org/D43375





More information about the llvm-commits mailing list