aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-11-23 14:40:05 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-11-23 14:40:05 +0000
commite600f2198f7dcdbdad2d469a3d498f6dbafb4468 (patch)
treeb78ada2a6538f446a7584ca6ebf21c4d3f9ea03d /gcc/tree-vectorizer.c
parent07ce14666601681f7638e8e955740566ce3386ec (diff)
downloadgcc-e600f2198f7dcdbdad2d469a3d498f6dbafb4468.zip
gcc-e600f2198f7dcdbdad2d469a3d498f6dbafb4468.tar.gz
gcc-e600f2198f7dcdbdad2d469a3d498f6dbafb4468.tar.bz2
re PR tree-optimization/78396 (gcc.dg/vect/bb-slp-cond-1.c FAILs after fix for PR77848)
2016-11-23 Richard Biener <rguenther@suse.de> PR tree-optimization/78396 * tree-vectorizer.c (vectorize_loops): If an innermost loop didn't vectorize try vectorizing an if-converted body using BB vectorization. * gcc.dg/vect/bb-slp-cond-1.c: Adjust. From-SVN: r242759
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 35d7a3e..b390664 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -540,6 +540,7 @@ vectorize_loops (void)
|| loop->force_vectorize)
{
loop_vec_info loop_vinfo, orig_loop_vinfo = NULL;
+ gimple *loop_vectorized_call = vect_loop_vectorized_call (loop);
vectorize_epilogue:
vect_location = find_loop_location (loop);
if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION
@@ -558,6 +559,33 @@ vectorize_epilogue:
if (loop_constraint_set_p (loop, LOOP_C_FINITE))
vect_free_loop_info_assumptions (loop);
+ /* If we applied if-conversion then try to vectorize the
+ BB of innermost loops.
+ ??? Ideally BB vectorization would learn to vectorize
+ control flow by applying if-conversion on-the-fly, the
+ following retains the if-converted loop body even when
+ only non-if-converted parts took part in BB vectorization. */
+ if (flag_tree_slp_vectorize != 0
+ && loop_vectorized_call
+ && ! loop->inner)
+ {
+ basic_block bb = loop->header;
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ gimple_set_uid (stmt, -1);
+ gimple_set_visited (stmt, false);
+ }
+ if (vect_slp_bb (bb))
+ {
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+ "basic block vectorized\n");
+ fold_loop_vectorized_call (loop_vectorized_call,
+ boolean_true_node);
+ ret |= TODO_cleanup_cfg;
+ }
+ }
continue;
}
@@ -575,7 +603,6 @@ vectorize_epilogue:
break;
}
- gimple *loop_vectorized_call = vect_loop_vectorized_call (loop);
if (loop_vectorized_call)
set_uid_loop_bbs (loop_vinfo, loop_vectorized_call);
if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION