This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [WIP] Possible Bug in vect_bb_slp_scalar_cost?


On Fri, Aug 4, 2017 at 12:08 PM, Dominik Inführ
<dominik.infuehr@theobroma-systems.com> wrote:
> Hi,
>
> 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;
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]