Hi! The first two hunks are similar issue to what I've posted for vect_permute_load_chain two days ago, the remaining issue is that if ncopies > 1, we'd leak the result_chain vector too.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-03-01 Jakub Jelinek <ja...@redhat.com> PR middle-end/56461 * tree-vect-data-refs.c (vect_permute_store_chain): Avoid using copy method on dr_chain and result_chain. * tree-vect-stmts.c (vectorizable_store): Only call result_chain.create if j == 0. --- gcc/tree-vect-data-refs.c.jj 2013-02-27 23:05:57.000000000 +0100 +++ gcc/tree-vect-data-refs.c 2013-03-01 17:41:12.296992793 +0100 @@ -4218,7 +4218,9 @@ vect_permute_store_chain (vec<tree> dr_c unsigned int j, nelt = TYPE_VECTOR_SUBPARTS (vectype); unsigned char *sel = XALLOCAVEC (unsigned char, nelt); - *result_chain = dr_chain.copy (); + result_chain->quick_grow (length); + memcpy (result_chain->address (), dr_chain.address (), + length * sizeof (tree)); for (i = 0, n = nelt / 2; i < n; i++) { @@ -4259,7 +4261,8 @@ vect_permute_store_chain (vec<tree> dr_c vect_finish_stmt_generation (stmt, perm_stmt, gsi); (*result_chain)[2*j+1] = low; } - dr_chain = result_chain->copy (); + memcpy (dr_chain.address (), result_chain->address (), + length * sizeof (tree)); } } --- gcc/tree-vect-stmts.c.jj 2013-03-01 13:33:37.000000000 +0100 +++ gcc/tree-vect-stmts.c 2013-03-01 17:35:17.146958118 +0100 @@ -4135,7 +4135,8 @@ vectorizable_store (gimple stmt, gimple_ new_stmt = NULL; if (grouped_store) { - result_chain.create (group_size); + if (j == 0) + result_chain.create (group_size); /* Permute. */ vect_permute_store_chain (dr_chain, group_size, stmt, gsi, &result_chain); Jakub