[gcc r12-6795] tree-optimization/100089 - BB vectorization of if-converted loop bodies
Richard Biener
rguenth@gcc.gnu.org
Fri Jan 21 13:23:19 GMT 2022
https://gcc.gnu.org/g:199cd0e0f8744ca1e61a95987b2d020a592a46d9
commit r12-6795-g199cd0e0f8744ca1e61a95987b2d020a592a46d9
Author: Richard Biener <rguenther@suse.de>
Date: Fri Jan 21 13:29:06 2022 +0100
tree-optimization/100089 - BB vectorization of if-converted loop bodies
The PR complains that when we only partially BB vectorize an
if-converted loop body that this can leave unvectorized code
unconditionally executed and thus effectively slow down code.
For -O2 we already mitigated the issue by not doing BB vectorization
when not all if-converted stmts were covered but the issue is
present with -O3 as well. Thus the following simply extends the
fix to cover all but the unlimited cost models. It is after all
very likely that we vectorize some stmts, if only a single
paired store.
2022-01-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/100089
* tree-vect-slp.cc (vect_slp_region): Reject BB vectorization
of if-converted loops with unvectorized COND_EXPRs for
all but the unlimited cost models.
Diff:
---
gcc/tree-vect-slp.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 5ffb63689f2..926106c4ecd 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5906,9 +5906,8 @@ vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> datarefs,
profitable_subgraphs.safe_push (instance);
}
- /* When we're vectorizing an if-converted loop body with the
- very-cheap cost model make sure we vectorized all if-converted
- code. */
+ /* When we're vectorizing an if-converted loop body make sure
+ we vectorized all if-converted code. */
if (!profitable_subgraphs.is_empty ()
&& orig_loop)
{
@@ -5924,7 +5923,7 @@ vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> datarefs,
gimple_set_visited (gsi_stmt (gsi), false);
continue;
}
- if (flag_vect_cost_model != VECT_COST_MODEL_VERY_CHEAP)
+ if (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED)
continue;
if (gassign *ass = dyn_cast <gassign *> (gsi_stmt (gsi)))
More information about the Gcc-cvs
mailing list