Commit 9c4f0d31 by Richard Biener

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.
parent f4d83eba
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.
2020-01-19 Eric S. Raymond <esr@thyrsus.com> 2020-01-19 Eric S. Raymond <esr@thyrsus.com>
* doc/contribute.texi: Update for SVN -> Git transition. * doc/contribute.texi: Update for SVN -> Git transition.
......
2020-01-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/93094
* gcc.dg/vect/pr93094.c: New testcase.
2020-01-19 David Malcolm <dmalcolm@redhat.com> 2020-01-19 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Ensure that all * gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Ensure that all
......
/* { dg-do compile } */
/* { dg-additional-options "-O3 -fno-tree-pre" } */
/* { dg-additional-options "-mavx512bw" { target x86_64-*-* i?86-*-* } } */
void
ll (char *un, char *rr, int te, int fp, int nb)
{
const int xe = nb & 1;
while (fp-- != 0)
{
if ((rr[0] & xe) == 0)
un[0] = 0;
un += te;
rr += te;
}
}
...@@ -3205,7 +3205,8 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr) ...@@ -3205,7 +3205,8 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr)
*COND_EXPR_STMT_LIST. */ *COND_EXPR_STMT_LIST. */
class loop * 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 *loop = LOOP_VINFO_LOOP (loop_vinfo), *nloop;
class loop *scalar_loop = LOOP_VINFO_SCALAR_LOOP (loop_vinfo); class loop *scalar_loop = LOOP_VINFO_SCALAR_LOOP (loop_vinfo);
...@@ -3339,18 +3340,18 @@ vect_loop_versioning (loop_vec_info 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 if-conversion re-use that. Note we cannot re-use the copy of
an if-converted outer-loop when vectorizing the inner loop only. */ an if-converted outer-loop when vectorizing the inner loop only. */
gcond *cond; gcond *cond;
gimple *call;
if ((!loop_to_version->inner || loop == loop_to_version) 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); 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); gimple_cond_set_condition_from_tree (cond, cond_expr);
update_stmt (cond); update_stmt (cond);
if (cond_expr_stmt_list) 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_insert_seq_before (&cond_exp_gsi, cond_expr_stmt_list,
GSI_SAME_STMT); GSI_SAME_STMT);
} }
......
...@@ -8487,7 +8487,7 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance) ...@@ -8487,7 +8487,7 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance)
Returns scalar epilogue loop if any. */ Returns scalar epilogue loop if any. */
class loop * class loop *
vect_transform_loop (loop_vec_info loop_vinfo) vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
{ {
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
class loop *epilogue = NULL; class loop *epilogue = NULL;
...@@ -8538,7 +8538,7 @@ vect_transform_loop (loop_vec_info loop_vinfo) ...@@ -8538,7 +8538,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if (LOOP_REQUIRES_VERSIONING (loop_vinfo)) if (LOOP_REQUIRES_VERSIONING (loop_vinfo))
{ {
class loop *sloop class loop *sloop
= vect_loop_versioning (loop_vinfo); = vect_loop_versioning (loop_vinfo, loop_vectorized_call);
sloop->force_vectorize = false; sloop->force_vectorize = false;
check_profitability = false; check_profitability = false;
} }
......
...@@ -986,7 +986,8 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab, ...@@ -986,7 +986,8 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
"loop vectorized using variable length vectors\n"); "loop vectorized using variable length vectors\n");
} }
loop_p new_loop = vect_transform_loop (loop_vinfo); loop_p new_loop = vect_transform_loop (loop_vinfo,
loop_vectorized_call);
(*num_vectorized_loops)++; (*num_vectorized_loops)++;
/* Now that the loop has been vectorized, allow it to be unrolled /* Now that the loop has been vectorized, allow it to be unrolled
etc. */ etc. */
......
...@@ -1682,7 +1682,7 @@ extern void vect_set_loop_condition (class loop *, loop_vec_info, ...@@ -1682,7 +1682,7 @@ extern void vect_set_loop_condition (class loop *, loop_vec_info,
extern bool slpeel_can_duplicate_loop_p (const class loop *, const_edge); extern bool slpeel_can_duplicate_loop_p (const class loop *, const_edge);
class loop *slpeel_tree_duplicate_loop_to_edge_cfg (class loop *, class loop *slpeel_tree_duplicate_loop_to_edge_cfg (class loop *,
class loop *, edge); class loop *, edge);
class loop *vect_loop_versioning (loop_vec_info); class loop *vect_loop_versioning (loop_vec_info, gimple *);
extern class loop *vect_do_peeling (loop_vec_info, tree, tree, extern class loop *vect_do_peeling (loop_vec_info, tree, tree,
tree *, tree *, tree *, int, bool, bool, tree *, tree *, tree *, int, bool, bool,
tree *); tree *);
...@@ -1821,7 +1821,7 @@ extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *, ...@@ -1821,7 +1821,7 @@ extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *,
extern stmt_vec_info info_for_reduction (stmt_vec_info); extern stmt_vec_info info_for_reduction (stmt_vec_info);
/* Drive for loop transformation stage. */ /* Drive for loop transformation stage. */
extern class loop *vect_transform_loop (loop_vec_info); extern class loop *vect_transform_loop (loop_vec_info, gimple *);
extern opt_loop_vec_info vect_analyze_loop_form (class loop *, extern opt_loop_vec_info vect_analyze_loop_form (class loop *,
vec_info_shared *); vec_info_shared *);
extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *, extern bool vectorizable_live_operation (stmt_vec_info, gimple_stmt_iterator *,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment