This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Dec 2015 14:08:33 +0000
- Subject: [Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction
- Auto-submitted: auto-generated
- References: <bug-61171-4 at http dot gcc dot gnu dot org/bugzilla/>
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.