From faa5399be693b2cdea641b976156f0fc89fa10cf Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 29 Aug 2017 07:04:31 +0000 Subject: tree-vect-slp.c (vect_bb_slp_scalar_cost): Properly confine life to the active subtree. 2017-08-29 Richard Biener Dominik Infuehr * tree-vect-slp.c (vect_bb_slp_scalar_cost): Properly confine life to the active subtree. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c: New testcase. Co-Authored-By: Dominik Infuehr From-SVN: r251398 --- gcc/tree-vect-slp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/tree-vect-slp.c') diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 04ecaab..2167293 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2690,9 +2690,18 @@ vect_bb_slp_scalar_cost (basic_block bb, scalar_cost += stmt_cost; } + auto_vec subtree_life; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - if (SLP_TREE_DEF_TYPE (child) == vect_internal_def) - scalar_cost += vect_bb_slp_scalar_cost (bb, child, life); + { + if (SLP_TREE_DEF_TYPE (child) == vect_internal_def) + { + /* Do not directly pass LIFE to the recursive call, copy it to + confine changes in the callee to the current child/subtree. */ + subtree_life.safe_splice (*life); + scalar_cost += vect_bb_slp_scalar_cost (bb, child, &subtree_life); + subtree_life.truncate (0); + } + } return scalar_cost; } -- cgit v1.1