From e72baed7e945f47609207ec8be4994e586e70649 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 24 Mar 2015 11:45:09 +0100 Subject: [PATCH] re PR tree-optimization/65533 (252.eon in SPEC CPU 2000 failed to build) 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 | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr65533.c | 25 +++++++++++++++++++++++++ gcc/tree-vect-slp.c | 9 ++++++++- 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr65533.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94643feb286..262fdedd865 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-03-24 Jakub Jelinek + + 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 PR middle-end/65517 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6049784558f..a1ad9e9f50f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-24 Jakub Jelinek + + PR tree-optimization/65533 + * gcc.dg/pr65533.c: New test. + 2015-03-24 Andre Vehreschild * 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 index 00000000000..49edf15c00e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65533.c @@ -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); +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index c57a5caf68b..73ab24e8f3b 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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]; -- 2.30.2