tree-optimization/100089 - avoid leaving scalar if-converted code around
authorRichard Biener <rguenther@suse.de>
Tue, 24 Aug 2021 10:25:25 +0000 (12:25 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 24 Aug 2021 12:23:00 +0000 (14:23 +0200)
commit9216ee6d1195d48388f825cf1b072e570129cbbe
tree742d1a0d6e52bd6723e3d220f48e594a49692f22
parent809330ab8450261e05919b472783bf15e4b000f7
tree-optimization/100089 - avoid leaving scalar if-converted code around

This avoids leaving scalar if-converted code around for the case
of BB vectorizing an if-converted loop body when using the very-cheap
cost model.  In this case we scan not vectorized scalar stmts in
the basic-block vectorized for COND_EXPRs and force the vectorization
to be marked as not profitable.

The patch also makes sure to always consider all BB vectorization
subgraphs together for costing purposes when vectorizing an
if-converted loop body.

2021-08-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100089
* tree-vectorizer.h (vect_slp_bb): Rename to ...
(vect_slp_if_converted_bb): ... this and get the original
loop as new argument.
* tree-vectorizer.c (try_vectorize_loop_1): Revert previous fix,
pass original loop to vect_slp_if_converted_bb.
* tree-vect-slp.c (vect_bb_vectorization_profitable_p):
If orig_loop was passed scan the not vectorized stmts
for COND_EXPRs and force not profitable if found.
(vect_slp_region): Pass down all SLP instances to costing
if orig_loop was specified.
(vect_slp_bbs): Pass through orig_loop.
(vect_slp_bb): Rename to ...
(vect_slp_if_converted_bb): ... this and get the original
loop as new argument.
(vect_slp_function): Adjust.
gcc/tree-vect-slp.c
gcc/tree-vectorizer.c
gcc/tree-vectorizer.h