This is the mail archive of the
mailing list for the GCC project.
Re: [WIP] Possible Bug in vect_bb_slp_scalar_cost?
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Dominik Inführ <dominik dot infuehr at theobroma-systems dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 4 Aug 2017 12:19:01 +0200
- Subject: Re: [WIP] Possible Bug in vect_bb_slp_scalar_cost?
- Authentication-results: sourceware.org; auth=none
- References: <5437EC6D-D7EA-4381-A218-31BAF72AF53B@theobroma-systems.com>
On Fri, Aug 4, 2017 at 12:08 PM, Dominik Inführ
> vect_bb_slp_scalar_cost computes the scalar cost of a SLP node. If there are non-scalar uses of a definition, the costs for it and its operands (children) are ignored. The vector LIFE is used to keep track of this and an element is set to true, such that the def and its children are ignored. But as soon as an element is set to true it is never undone, that means the following sibling and parent nodes of the current node also stay ignored.
Yes, that's intended. They are live as well because they are needed
to compute the live scalar.
This seems wrong to me, a simple fix would be to clone LIFE for every
vector, such that changes to LIFE stay in the subtree:
> diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
> index 032a9444a5a..f919645f28b 100644
> --- a/gcc/tree-vect-slp.c
> +++ b/gcc/tree-vect-slp.c
> @@ -2590,6 +2590,11 @@ vect_bb_slp_scalar_cost (basic_block bb,
> gimple *stmt;
> slp_tree child;
> + auto_vec<bool, 20> subtree_life;
> + subtree_life.safe_splice (*life);
> + life = &subtree_life;
> FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt)
> unsigned stmt_cost;