summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-09 12:13:19 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-09 12:13:19 +0000
commita18d432721f3762fca7dc8b98c7b497adea649e2 (patch)
tree880e263ea8d9289591a085f2218e119f7dc29604 /gcc
parentd5e884a5a9c1b7de1556e6791373f244dac4884c (diff)
downloadgcc-a18d432721f3762fca7dc8b98c7b497adea649e2.tar.gz
PR tree-optimization/41008
* tree-vect-loop.c (vect_is_simple_reduction): Get operands from condition only in case it's a comparison. Adjust checks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150591 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/O1-pr41008.c23
-rw-r--r--gcc/tree-vect-loop.c15
4 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index be426c4c04b..f4a8a140080 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-09 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/41008
+ * tree-vect-loop.c (vect_is_simple_reduction): Get operands
+ from condition only in case it's a comparison. Adjust checks.
+
2009-08-09 Bernd Schmidt <bernd.schmidt@analog.com>
* tree-dfa.c (renumber_gimple_stmt_uids_in_blocks): New function.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c45d289f3da..346cc709133 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-09 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/41008
+ * gcc.dg/vect/O1-pr41008.c: New test.
+
2009-08-05 Tobias Burnus <burnus@net-b.de>
PR fortran/40955
diff --git a/gcc/testsuite/gcc.dg/vect/O1-pr41008.c b/gcc/testsuite/gcc.dg/vect/O1-pr41008.c
new file mode 100644
index 00000000000..bbdea127ce8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/O1-pr41008.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+double heating[2][2];
+
+void foo (int, int);
+
+void map_do()
+{
+ int jsav, ksav, k, j;
+
+ for(k = 0; k < 2; k++)
+ for(j = 0; j < 2; j++)
+ if (heating[k][j] > 0.)
+ {
+ jsav = j;
+ ksav = k;
+ }
+
+ foo (jsav, ksav);
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 113dc0ff0e6..b322213f108 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1705,8 +1705,13 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi,
return NULL;
}
- op3 = TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0), 0);
- op4 = TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0), 1);
+ op3 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0);
+ if (COMPARISON_CLASS_P (op3))
+ {
+ op4 = TREE_OPERAND (op3, 1);
+ op3 = TREE_OPERAND (op3, 0);
+ }
+
op1 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 1);
op2 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 2);
@@ -1750,10 +1755,14 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi,
print_generic_expr (vect_dump, TREE_TYPE (op1), TDF_SLIM);
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op2), TDF_SLIM);
- if (op3 && op4)
+ if (op3)
{
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op3), TDF_SLIM);
+ }
+
+ if (op4)
+ {
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op4), TDF_SLIM);
}