OSDN Git Service

PR tree-optimization/50451
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2011 07:21:07 +0000 (07:21 +0000)
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2011 07:21:07 +0000 (07:21 +0000)
        * tree-vect-slp.c (vect_get_constant_vectors): Don't fail for
        constant operands in reduction.
        (vect_get_slp_defs): Don't create vector operand for NULL scalar
        operand.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179079 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr50451.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index 5f18359..164daa3 100644 (file)
@@ -1,3 +1,11 @@
+2011-09-22  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50451
+       * tree-vect-slp.c (vect_get_constant_vectors): Don't fail for
+       constant operands in reduction.
+       (vect_get_slp_defs): Don't create vector operand for NULL scalar
+       operand.
+
 2011-09-22  David S. Miller  <davem@davemloft.net>
 
        * config/sparc/sparc.c (sparc_vis_init_builtins): Do not mark
index 99436d1..0c9ffed 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-22  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50451
+       * gcc.dg/vect/pr50451.c: New test.
+
 2011-09-21  Ian Lance Taylor  <iant@google.com>
 
        * go.test/go-test.exp (errchk): Add special case for bug332.
diff --git a/gcc/testsuite/gcc.dg/vect/pr50451.c b/gcc/testsuite/gcc.dg/vect/pr50451.c
new file mode 100644 (file)
index 0000000..0733ea2
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+int
+foo (int integral, int decimal, int power_ten)
+{
+  while (power_ten > 0)
+    {
+      integral *= 10;
+      decimal *= 10;
+      power_ten--;
+    }
+
+  return integral+decimal;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
index 669b2bb..9171ba9 100644 (file)
@@ -1905,14 +1905,9 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
   gimple def_stmt;
   struct loop *loop;
 
-  if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
+  if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
+      && reduc_index != -1)
     {
-      if (reduc_index == -1)
-        {
-          VEC_free (tree, heap, *vec_oprnds);
-          return;
-        }
-
       op_num = reduc_index - 1;
       op = gimple_op (stmt, reduc_index);
       /* For additional copies (see the explanation of NUMBER_OF_COPIES below)
@@ -2164,7 +2159,7 @@ vect_get_slp_defs (tree op0, tree op1, slp_tree slp_node,
     return;
 
   code = gimple_assign_rhs_code (first_stmt);
-  if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS || !vec_oprnds1)
+  if (get_gimple_rhs_class (code) != GIMPLE_BINARY_RHS || !vec_oprnds1 || !op1)
     return;
 
   /* The number of vector defs is determined by the number of vector statements