aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop-manip.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-01-15 14:25:38 +0100
committerRichard Biener <rguenther@suse.de>2020-01-20 09:48:42 +0100
commit9c4f0d311810eba3f4faab1295c47eb57e695fcc (patch)
treee3106f187f8e8c8c359cf9ae58aa14038749a0be /gcc/tree-vect-loop-manip.c
parentf4d83eba60b5b1292a7cae660f03a2377e92a845 (diff)
downloadgcc-9c4f0d311810eba3f4faab1295c47eb57e695fcc.zip
gcc-9c4f0d311810eba3f4faab1295c47eb57e695fcc.tar.gz
gcc-9c4f0d311810eba3f4faab1295c47eb57e695fcc.tar.bz2
tree-optimization/93094 pass down VECTORIZED_CALL to versioning
When versioning is run the IL is already mangled and finding a VECTORIZED_CALL IFN can fail. 2020-01-20 Richard Biener <rguenther@suse.de> PR tree-optimization/93094 * tree-vectorizer.h (vect_loop_versioning): Adjust. (vect_transform_loop): Likewise. * tree-vectorizer.c (try_vectorize_loop_1): Pass down loop_vectorized_call to vect_transform_loop. * tree-vect-loop.c (vect_transform_loop): Pass down loop_vectorized_call to vect_loop_versioning. * tree-vect-loop-manip.c (vect_loop_versioning): Use the earlier discovered loop_vectorized_call. * gcc.dg/vect/pr93094.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r--gcc/tree-vect-loop-manip.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 52ca4e3..0ee1ab4 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -3205,7 +3205,8 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr)
*COND_EXPR_STMT_LIST. */
class loop *
-vect_loop_versioning (loop_vec_info loop_vinfo)
+vect_loop_versioning (loop_vec_info loop_vinfo,
+ gimple *loop_vectorized_call)
{
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo), *nloop;
class loop *scalar_loop = LOOP_VINFO_SCALAR_LOOP (loop_vinfo);
@@ -3339,18 +3340,18 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
if-conversion re-use that. Note we cannot re-use the copy of
an if-converted outer-loop when vectorizing the inner loop only. */
gcond *cond;
- gimple *call;
if ((!loop_to_version->inner || loop == loop_to_version)
- && (call = vect_loop_vectorized_call (loop_to_version, &cond)))
+ && loop_vectorized_call)
{
gcc_assert (scalar_loop);
- condition_bb = gimple_bb (cond);
+ condition_bb = gimple_bb (loop_vectorized_call);
+ cond = as_a <gcond *> (last_stmt (condition_bb));
gimple_cond_set_condition_from_tree (cond, cond_expr);
update_stmt (cond);
if (cond_expr_stmt_list)
{
- cond_exp_gsi = gsi_for_stmt (call);
+ cond_exp_gsi = gsi_for_stmt (loop_vectorized_call);
gsi_insert_seq_before (&cond_exp_gsi, cond_expr_stmt_list,
GSI_SAME_STMT);
}