From 99f51320d47ba6565b21dbf9a1ec999b193fde0a Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Tue, 16 Feb 2010 11:35:03 +0000 Subject: [PATCH] re PR tree-optimization/43074 (ICE in vectorizable_reduction, at tree-vect-loop.c:3491) PR tree-optimization/43074 * tree-vectorizer.h (VECTORIZABLE_CYCLE_DEF): New. * tree-vect-loop.c (vect_analyze_loop_operations): Add vectorizable cycles in hybrid SLP check. * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise. From-SVN: r156800 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c | 16 ++++++++++++++++ gcc/tree-vect-loop.c | 5 ++++- gcc/tree-vect-slp.c | 8 +++++--- gcc/tree-vectorizer.h | 4 ++++ 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83879235ca0..4495a310997 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-02-16 Ira Rosen + + PR tree-optimization/43074 + * tree-vectorizer.h (VECTORIZABLE_CYCLE_DEF): New. + * tree-vect-loop.c (vect_analyze_loop_operations): Add + vectorizable cycles in hybrid SLP check. + * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise. + 2010-02-16 Richard Guenther * alias.c (memrefs_conflict_p): Distinguish must-alias from diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c512343bd5..7e06ff711c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-02-16 Ira Rosen + + PR tree-optimization/43074 + * gcc.dg/vect/fast-math-pr43074.c: New test. + 2010-02-16 Jakub Jelinek * lib/prune.exp: Prune variable tracking size limit exceeded diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c b/gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c new file mode 100644 index 00000000000..80077ba7d0d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/fast-math-pr43074.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +float +pvslockprocess(float *fout, float *fin, int framesize) +{ + int i; + float mag=0.0f, diff; + for (i = 0; i < framesize; i += 2) { + mag += fin[i]; + fout[i] = fin[i]; + fout[i+1] = fin[i+1]; + } + return mag; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 9e17eb36670..16aa242e7fe 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1184,7 +1184,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) if (!vect_analyze_stmt (stmt, &need_to_vectorize, NULL)) return false; - if (STMT_VINFO_RELEVANT_P (stmt_info) && !PURE_SLP_STMT (stmt_info)) + if ((STMT_VINFO_RELEVANT_P (stmt_info) + || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info))) + && !PURE_SLP_STMT (stmt_info)) + /* STMT needs both SLP and loop-based vectorization. */ only_slp_in_loop = false; } diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index bbf2bd31820..5a11b84a953 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1102,6 +1102,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node) gimple stmt; imm_use_iterator imm_iter; gimple use_stmt; + stmt_vec_info stmt_vinfo; if (!node) return; @@ -1110,9 +1111,10 @@ vect_detect_hybrid_slp_stmts (slp_tree node) if (PURE_SLP_STMT (vinfo_for_stmt (stmt)) && TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME) FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0)) - if (vinfo_for_stmt (use_stmt) - && !STMT_SLP_TYPE (vinfo_for_stmt (use_stmt)) - && STMT_VINFO_RELEVANT (vinfo_for_stmt (use_stmt))) + if ((stmt_vinfo = vinfo_for_stmt (use_stmt)) + && !STMT_SLP_TYPE (stmt_vinfo) + && (STMT_VINFO_RELEVANT (stmt_vinfo) + || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)))) vect_mark_slp_stmts (node, hybrid, i); vect_detect_hybrid_slp_stmts (SLP_TREE_LEFT (node)); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index b7c6316f9c6..2217a7ccc03 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -66,6 +66,10 @@ enum vect_def_type { vect_unknown_def_type }; +#define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \ + || ((D) == vect_double_reduction_def) \ + || ((D) == vect_nested_cycle)) + /* Define verbosity levels. */ enum verbosity_levels { REPORT_NONE,