OSDN Git Service

PR tree-optimization/41008
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Aug 2009 12:13:19 +0000 (12:13 +0000)
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Aug 2009 12:13:19 +0000 (12:13 +0000)
* 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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/O1-pr41008.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index be426c4..f4a8a14 100644 (file)
@@ -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.
index c45d289..346cc70 100644 (file)
@@ -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 (file)
index 0000000..bbdea12
--- /dev/null
@@ -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" } } */
+
index 113dc0f..b322213 100644 (file)
@@ -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);
             }