aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-02-21 13:18:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-02-21 13:18:54 +0000
commitf2556b68cad88433577a0baab1b76bef59f49d78 (patch)
tree1e75ea5d008d884d77d7e4d771c8dff421db6753 /gcc/tree-vect-stmts.c
parent32417082bf9a8f2633e7960f2e45979ebab43e51 (diff)
downloadgcc-f2556b68cad88433577a0baab1b76bef59f49d78.zip
gcc-f2556b68cad88433577a0baab1b76bef59f49d78.tar.gz
gcc-f2556b68cad88433577a0baab1b76bef59f49d78.tar.bz2
re PR tree-optimization/60276 (-O3 autovectorizer breaks on a particular loop)
2014-02-21 Richard Biener <rguenther@suse.de> PR tree-optimization/60276 * tree-vectorizer.h (struct _stmt_vec_info): Add min_neg_dist field. (STMT_VINFO_MIN_NEG_DIST): New macro. * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Record STMT_VINFO_MIN_NEG_DIST. * tree-vect-stmts.c (vectorizable_load): Verify if assumptions made for negative dependence distances still hold. * gcc.dg/vect/pr60276.c: New testcase. From-SVN: r207992
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 7e47feb..70fb411 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5629,6 +5629,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
return false;
}
+ /* Invalidate assumptions made by dependence analysis when vectorization
+ on the unrolled body effectively re-orders stmts. */
+ if (ncopies > 1
+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0
+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo)
+ > STMT_VINFO_MIN_NEG_DIST (stmt_info)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "cannot perform implicit CSE when unrolling "
+ "with negative dependence distance\n");
+ return false;
+ }
+
if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false;
@@ -5686,6 +5700,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
else if (!vect_grouped_load_supported (vectype, group_size))
return false;
}
+
+ /* Invalidate assumptions made by dependence analysis when vectorization
+ on the unrolled body effectively re-orders stmts. */
+ if (!PURE_SLP_STMT (stmt_info)
+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0
+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo)
+ > STMT_VINFO_MIN_NEG_DIST (stmt_info)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "cannot perform implicit CSE when performing "
+ "group loads with negative dependence distance\n");
+ return false;
+ }
}