]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/121830 - SLP cycle detection confused by nested cycle
authorRichard Biener <rguenther@suse.de>
Mon, 8 Sep 2025 11:25:37 +0000 (13:25 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 8 Sep 2025 12:40:18 +0000 (14:40 +0200)
commitf7426ba6c0d4f779ff0f2f84e8beeadc88ebe47c
treedab6a77727ea570c4a022de1153835f4eebf8c9a
parenta632becefad29206a980cc080eee74ed808f9cd3
tree-optimization/121830 - SLP cycle detection confused by nested cycle

The SLP reduc-index computation is confused by having an outer reduction
inner loop nested cycle fed by another non-reduction nested cycle.
Instead of undoing the unfortunate mixing of outer reduction inner
cycles with general nested cycles the following instead distinguishes
them by not setting STMT_VINFO_REDUC_DEF on the non-reduction nested
cycles.

PR tree-optimization/121830
* tree-vect-loop.cc (vect_analyze_scalar_cycles_1): Only
set STMT_VINFO_REDUC_DEF on reductions.
* tree-vect-slp.cc (vect_build_slp_tree_2): Identify reduction
PHIs by a set STMT_VINFO_REDUC_DEF instead of their def type.

* gcc.dg/vect/pr121830.c: New testcase.
gcc/testsuite/gcc.dg/vect/pr121830.c [new file with mode: 0644]
gcc/tree-vect-loop.cc
gcc/tree-vect-slp.cc