]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/119057 - bogus double reduction detection
authorRichard Biener <rguenther@suse.de>
Mon, 3 Mar 2025 12:21:53 +0000 (13:21 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 2 Apr 2025 12:00:17 +0000 (14:00 +0200)
commitfaadd1d27a85478f43c90cf780f980d0cbd37b85
tree63a08dccac65e406e6dc99f9fdd48d0be60be7ea
parented7f67d951292a3f93e5509741b511fd9ea7da30
tree-optimization/119057 - bogus double reduction detection

We are detecting a cycle as double reduction where the inner loop
cycle has extra out-of-loop uses.  This clashes at least with
assumptions from the SLP discovery code which says the cycle
isn't reachable from another SLP instance.  It also was not intended
to support this case, in fact with GCC 14 we seem to generate wrong
code here.

PR tree-optimization/119057
* tree-vect-loop.cc (check_reduction_path): Add argument
specifying whether we're analyzing the inner loop of a
double reduction.  Do not allow extra uses outside of the
double reduction cycle in this case.
(vect_is_simple_reduction): Adjust.

* gcc.dg/vect/pr119057.c: New testcase.

(cherry picked from commit 758de6263dfc7ba8701965fa468691ac23cb7eb5)
gcc/testsuite/gcc.dg/vect/pr119057.c [new file with mode: 0644]
gcc/tree-vect-loop.cc