]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/110381 - preserve SLP permutation with in-order reductions
authorRichard Biener <rguenther@suse.de>
Mon, 26 Jun 2023 10:51:37 +0000 (12:51 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 26 Jun 2023 12:14:54 +0000 (14:14 +0200)
commit53d6f57c1b20c6da52aefce737fb7d5263686ba3
treeea464de31dd3bd20324ceb81ea7dd6aa7aa9881d
parenta024176a97b0176f526862836c33e283b8db4197
tree-optimization/110381 - preserve SLP permutation with in-order reductions

The following fixes a bug that manifests itself during fold-left
reduction transform in picking not the last scalar def to replace
and thus double-counting some elements.  But the underlying issue
is that we merge a load permutation into the in-order reduction
which is of course wrong.

Now, reduction analysis has not yet been performend when optimizing
permutations so we have to resort to check that ourselves.

PR tree-optimization/110381
* tree-vect-slp.cc (vect_optimize_slp_pass::start_choosing_layouts):
Materialize permutes before fold-left reductions.

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