tree-optimization/99253 - fix reduction path check
authorRichard Biener <rguenther@suse.de>
Thu, 25 Feb 2021 08:36:33 +0000 (09:36 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 25 Feb 2021 09:28:49 +0000 (10:28 +0100)
commit1193d05465acd39b6e3c7095274d8351a1e2cd44
tree0f422ff8bf1153956f0617bed7b072e384aa3dab
parent880682e7b2348d66f4089fa4af102b69eaaefbc2
tree-optimization/99253 - fix reduction path check

This fixes an ordering problem with verifying that no intermediate
computations in a reduction path are used outside of the chain.  The
check was disabled for value-preserving conversions at the tail
but whether a stmt was a conversion or not was only computed after
the first use.  The following fixes this by re-ordering things
accordingly.

2021-02-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99253
* tree-vect-loop.c (check_reduction_path): First compute
code, then verify out-of-loop uses.

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