tree-optimization/114239 - rework reduction epilogue driving
commit89c443a7e9a0780a52a698fb02d4f5173e025918
authorRichard Biener <rguenther@suse.de>
Wed, 6 Mar 2024 09:31:02 +0000 (6 10:31 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 6 Mar 2024 12:05:49 +0000 (6 13:05 +0100)
tree815331179f66113e3f00354c072fe0111affb2c8
parent7719b9be2daa55edf336d721839300e62a7abbdc
tree-optimization/114239 - rework reduction epilogue driving

The following reworks vectorizable_live_operation to pass the
live stmt to vect_create_epilog_for_reduction also for early breaks
and a peeled main exit.  This is to be able to figure the scalar
definition to replace.  This reverts the PR114192 fix as it is
subsumed by this cleanup.

PR tree-optimization/114239
* tree-vect-loop.cc (vect_get_vect_def): Remove.
(vect_create_epilog_for_reduction): The passed in stmt_info
should now be the live stmt that produces the scalar reduction
result.  Revert PR114192 fix.  Base reduction info off
info_for_reduction.  Remove special handling of
early-break/peeled, restore original vector def gathering.
Make sure to pick the correct exit PHIs.
(vectorizable_live_operation): Pass in the proper stmt_info
for early break exits.

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