diff options
author | Richard Biener <rguenther@suse.de> | 2017-08-29 07:04:31 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-08-29 07:04:31 +0000 |
commit | faa5399be693b2cdea641b976156f0fc89fa10cf (patch) | |
tree | ad4a07ebbfb2bc4da545181403d9ab5c42c451d6 /gcc/tree-vect-slp.c | |
parent | 14d6281388bad11de8c328be7ea825b184fc7efe (diff) | |
download | gcc-faa5399be693b2cdea641b976156f0fc89fa10cf.zip gcc-faa5399be693b2cdea641b976156f0fc89fa10cf.tar.gz gcc-faa5399be693b2cdea641b976156f0fc89fa10cf.tar.bz2 |
tree-vect-slp.c (vect_bb_slp_scalar_cost): Properly confine life to the active subtree.
2017-08-29 Richard Biener <rguenther@suse.de>
Dominik Infuehr <dominik.infuehr@theobroma-systems.com>
* 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 <dominik.infuehr@theobroma-systems.com>
From-SVN: r251398
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r-- | gcc/tree-vect-slp.c | 13 |
1 files changed, 11 insertions, 2 deletions
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<bool, 20> 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; } |