aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-09-04 11:22:38 +0200
committerIra Rosen <irar@gcc.gnu.org>2011-09-04 09:22:38 +0000
commitad949bcc5e482ddd34bff6a3d01d02d5866155f8 (patch)
treeecd366ea21d066bd82366c0398e6cd3ddd01160f
parent7cd3603bf9a67ac0048541cc6698c174136e5a37 (diff)
downloadgcc-ad949bcc5e482ddd34bff6a3d01d02d5866155f8.zip
gcc-ad949bcc5e482ddd34bff6a3d01d02d5866155f8.tar.gz
gcc-ad949bcc5e482ddd34bff6a3d01d02d5866155f8.tar.bz2
re PR tree-optimization/50208 (ICE: in vinfo_for_stmt at tree-vectorizer.h:598 with -ftree-vectorize -fno-tree-fre -fno-tree-pre)
PR tree-optimization/50208 * tree-vect-patterns.c (vect_handle_widen_mult_by_const): Add an argument. Check that def_stmt is inside the loop. (vect_recog_widen_mult_pattern): Update calls to vect_handle_widen_mult_by_cons. (vect_operation_fits_smaller_type): Check that def_stmt is inside the loop. Co-Authored-By: Ira Rosen <ira.rosen@linaro.org> From-SVN: r178508
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-fre-pre-pr50208.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp6
-rw-r--r--gcc/tree-vect-patterns.c16
5 files changed, 55 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67f823f..c929cb0ea 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-04 Jakub Jelinek <jakub@redhat.com>
+ Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/50208
+ * tree-vect-patterns.c (vect_handle_widen_mult_by_const): Add an
+ argument. Check that def_stmt is inside the loop.
+ (vect_recog_widen_mult_pattern): Update calls to
+ vect_handle_widen_mult_by_cons.
+ (vect_operation_fits_smaller_type): Check that def_stmt is
+ inside the loop.
+
2011-09-04 Ira Rosen <ira.rosen@linaro.org>
* tree-vectorizer.c (vect_print_dump_info): Print line
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d779df3..3b6556d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-04 Jakub Jelinek <jakub@redhat.com>
+ Ira Rosen <ira.rosen@linaro.org>
+
+ PR tree-optimization/50208
+ * gcc.dg/vect/no-fre-pre-pr50208.c: New test.
+ * gcc.dg/vect/vect.exp: Run no-fre-pre-*.c tests with
+ -fno-tree-fre -fno-tree-pre.
+
2011-09-02 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipcp-3.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/no-fre-pre-pr50208.c b/gcc/testsuite/gcc.dg/vect/no-fre-pre-pr50208.c
new file mode 100644
index 0000000..26e2a64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/no-fre-pre-pr50208.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+char c;
+int a, b;
+
+void foo (int j)
+{
+ int i;
+ while (--j)
+ {
+ b = 3;
+ for (i = 0; i < 2; ++i)
+ a = b ^ c;
+ }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index ab92be4..8f57f29 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -263,6 +263,12 @@ lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \
"" $DEFAULT_VECTCFLAGS
+# -fno-tree-fre -fno-tree-pre
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-tree-pre"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \
+ "" $DEFAULT_VECTCFLAGS
+
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index ef6a4fd..0d78882 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -344,12 +344,14 @@ vect_recog_dot_prod_pattern (VEC (gimple, heap) **stmts, tree *type_in,
replace a_T = (TYPE) a_t; with a_it - (interm_type) a_t; */
static bool
-vect_handle_widen_mult_by_const (tree const_oprnd, tree *oprnd,
+vect_handle_widen_mult_by_const (gimple stmt, tree const_oprnd, tree *oprnd,
VEC (gimple, heap) **stmts, tree type,
tree *half_type, gimple def_stmt)
{
tree new_type, new_oprnd, tmp;
gimple new_stmt;
+ loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt));
+ struct loop *loop = LOOP_VINFO_LOOP (loop_info);
if (int_fits_type_p (const_oprnd, *half_type))
{
@@ -359,6 +361,8 @@ vect_handle_widen_mult_by_const (tree const_oprnd, tree *oprnd,
}
if (TYPE_PRECISION (type) < (TYPE_PRECISION (*half_type) * 4)
+ || !gimple_bb (def_stmt)
+ || !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|| !vinfo_for_stmt (def_stmt))
return false;
@@ -527,7 +531,8 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts,
{
if (TREE_CODE (oprnd0) == INTEGER_CST
&& TREE_CODE (half_type1) == INTEGER_TYPE
- && vect_handle_widen_mult_by_const (oprnd0, &oprnd1, stmts, type,
+ && vect_handle_widen_mult_by_const (last_stmt, oprnd0, &oprnd1,
+ stmts, type,
&half_type1, def_stmt1))
half_type0 = half_type1;
else
@@ -537,7 +542,8 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts,
{
if (TREE_CODE (oprnd1) == INTEGER_CST
&& TREE_CODE (half_type0) == INTEGER_TYPE
- && vect_handle_widen_mult_by_const (oprnd1, &oprnd0, stmts, type,
+ && vect_handle_widen_mult_by_const (last_stmt, oprnd1, &oprnd0,
+ stmts, type,
&half_type0, def_stmt0))
half_type1 = half_type0;
else
@@ -868,6 +874,8 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
tree interm_type = NULL_TREE, half_type, tmp, new_oprnd, type;
gimple def_stmt, new_stmt;
bool first = false;
+ loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt));
+ struct loop *loop = LOOP_VINFO_LOOP (loop_info);
*new_def_stmt = NULL;
@@ -898,6 +906,8 @@ vect_operation_fits_smaller_type (gimple stmt, tree def, tree *new_type,
{
first = true;
if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false)
+ || !gimple_bb (def_stmt)
+ || !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|| !vinfo_for_stmt (def_stmt))
return false;
}