https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122750

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
/* Reassociate (X * CST) * Y to (X * Y) * CST.  This does not introduce
   signed overflow for CST != 0 && CST != -1.  */
(simplify
 (mult:c (mult:s@3 @0 INTEGER_CST@1) @2)
 (if (TREE_CODE (@2) != INTEGER_CST
      && single_use (@3)
      && !integer_zerop (@1) && !integer_minus_onep (@1))
  (mult (mult @0 @2) @1)))
```

This does not take into account of `(IV * 10) * y` and IV being optimized.

For unsigned reassociate turns it back into `(IV * 10) * y` but then forwprop
via the above pattern turns it into what we don't want.

But turning off forwprop still gets us the multiply:
  vect__8.9_41 = vect_vec_iv_.8_36 * { 10, 10, 10, 10 };

And then ivopts does not optimize vector based ivs.

So there seems to be a few different things needed here.

Reply via email to