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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 02:29:12 PST 2018


mkazantsev added a comment.

In https://reviews.llvm.org/D43375#1012189, @apilipenko wrote:

> This is very similar to what we had as an initial implementation of loop predication. Later we found that this approach is problematic. See https://reviews.llvm.org/D37569 description for the details. This patch likely suffers from a similar problem.


I don't think it does. The problem with Loop Predication was that we made an implicit assumption that the loop backedge is taken, and if it actually wasn't (and the loop exited by guard's condition).

In this patch, we require the number of backedge taken count be computable. If the loop fails the guard after N-th iteration, this number should not exceed N. So the end value we take is not the value on theoretical "last" iteration after which we exit by loop condition, but the value before exiting by either exit condition.


https://reviews.llvm.org/D43375





More information about the llvm-commits mailing list