[PATCH] D104702: [LSR] Filter out zero factors. PR50765

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 20:49:21 PDT 2021


mkazantsev added a comment.

In D104702#2833650 <https://reviews.llvm.org/D104702#2833650>, @huihuiz wrote:

> Ideally we should reject early when stride is zero, but in this case we won't be able to detect this early since stride zero is in a form of add expression.
>
>   (((3 + (-1 * (74 smax (1 + %tmp3)))<nsw>)<nuw><nsw> * {(-2 + (-2 * (trunc i64 undef to i32))),+,-2}<%bb1>) + ((6 + (-2 * (74 smax (1 + %tmp3))))<nuw> * {(1 + (trunc i64 undef to i32)),+,1}<%bb1>))  // Zero stride as the LHS
>
> After getExactSDiv pull out common factor 2 , then we get an add expression that turn out to be zero.

That's a point where we could try to improve SCEV. But generally, it's not correct to assume that SCEV will or will not fully simplify something. It has a lot of limitations, one of which is depth threshold which simply cuts the simplification process for sake of saving CT.


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

https://reviews.llvm.org/D104702



More information about the llvm-commits mailing list