[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 10 14:08:00 GMT 2015


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
it's a matter of association being "unfortunate" or vector reduction detection
being too simplistic.

  # prephitmp_21 = PHI <pretmp_20(4), _9(7)>
...
  _2 = pretmp_18 + prephitmp_21;
  _9 = _2 - _6;

needs to be associated as

  _2 = pretmp_18 - _6;
  _9 = prephitmp_21 + _2;

usually reassoc is responsible for ensuring this but given its last iteration
is before LIM pulls out the global it has no chance to fix things up.

One fix would be to split out enough from reassoc into a worker that can
be called from vectorization or to run LIM before reassoc.


More information about the Gcc-bugs mailing list