]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/65533 (252.eon in SPEC CPU 2000 failed to build)
authorJakub Jelinek <jakub@redhat.com>
Tue, 24 Mar 2015 10:45:09 +0000 (11:45 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 24 Mar 2015 10:45:09 +0000 (11:45 +0100)
PR tree-optimization/65533
* tree-vect-slp.c (vect_build_slp_tree): Before re-trying
with swapped operands, call vect_free_slp_tree on
SLP_TREE_CHILDREN of child and truncate the SLP_TREE_CHILDREN
vector.

* gcc.dg/pr65533.c: New test.

From-SVN: r221622

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

index 94643feb28666533d7d57c2dfd171a570ac66ff4..262fdedd865530ec71098edc14cab7f760794174 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/65533
+       * tree-vect-slp.c (vect_build_slp_tree): Before re-trying
+       with swapped operands, call vect_free_slp_tree on
+       SLP_TREE_CHILDREN of child and truncate the SLP_TREE_CHILDREN
+       vector.
+
 2015-03-24  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/65517
index 6049784558fe7f8d840e41983b3ec83d7ef59053..a1ad9e9f50f910b08d389cf6f7d05c23f09df592 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/65533
+       * gcc.dg/pr65533.c: New test.
+
 2015-03-24  Andre Vehreschild  <vehre@gmx.de>
 
        * gfortran.dg/allocate_alloc_opt_13.f90: Added tests for
diff --git a/gcc/testsuite/gcc.dg/pr65533.c b/gcc/testsuite/gcc.dg/pr65533.c
new file mode 100644 (file)
index 0000000..49edf15
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR tree-optimization/65533 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -w" } */
+
+struct A { int a[2]; };
+struct B { double b[2]; };
+struct C { double c[4][1]; };
+
+static inline void
+bar (struct B *x, double y, double z)
+{
+  x->b[0] = y;
+  x->b[1] = z;
+}
+
+void baz (struct B *);
+
+void
+foo (struct C *x, struct A *y)
+{
+  struct B d;
+  bar (&d, x->c[1][0] * y->a[0] + x->c[0][1] * y->a[1] + x->c[0][0] * x->c[0][1],
+       x->c[0][0] * y->a[0] + x->c[0][1] * y->a[1] + x->c[0][1] * y->a[0] + x->c[0][0]);
+  baz (&d);
+}
index c57a5caf68b87ca55b03c18bf1227ab5e40c4b51..73ab24e8f3befa77ec158d531c48cd240e3aaecc 100644 (file)
@@ -1035,13 +1035,20 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
             behavior.  */
          && *npermutes < 4)
        {
+         unsigned int j;
+         slp_tree grandchild;
+
          /* Roll back.  */
          *max_nunits = old_max_nunits;
          loads->truncate (old_nloads);
+         FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
+           vect_free_slp_tree (grandchild);
+         SLP_TREE_CHILDREN (child).truncate (0);
+
          /* Swap mismatched definition stmts.  */
          dump_printf_loc (MSG_NOTE, vect_location,
                           "Re-trying with swapped operands of stmts ");
-         for (unsigned j = 0; j < group_size; ++j)
+         for (j = 0; j < group_size; ++j)
            if (!matches[j])
              {
                gimple tem = oprnds_info[0]->def_stmts[j];