On Mon, 5 Oct 2026, Alex Coplan wrote:

> Hi,
> 
> r17-71-g3f6d37193c7987ee9362c073dd5da6f7419c87b3 adds the following
> assert in vect_create_new_slp_node:
> 
>   gcc_assert (code == ERROR_MARK || code == VEC_PERM_EXPR);
> 
> which seems to suggest that SLP nodes should only ever have one of these
> two codes.

Yes, this is in preparation (TODO) for dropping 'code' in favor of
some (class?) sub-setting of slp_tree, separating permute from
regular nodes.

> Recently I have been studying how the recognition of complex add with
> rotate works.  There is code in vect_build_slp_tree_2 which, in the
> two_operators case, builds synthetic {PLUS,MINUS}_EXPR nodes which are
> then packed together with a permutation.  This is later recognized by
> the complex add slp pattern.
> 
> I noticed that this code sets the code fields of the synthetic nodes to
> the relevant tree codes, e.g. {PLUS,MINUS}_EXPR, but this isn't actually
> needed, since the pattern code just looks at the code of the
> representative stmt for non-permutation nodes.  It's also at odds with
> the recently-added assert above.
> 
> This patch therefore drops setting the codes on those nodes, and instead
> leaves them set to ERROR_MARK (meaning that consumers should look at the
> representative, as the patterns currently do).  It is intended to be a
> non-functional cleanup.
> 
> Bootstrapped/regtested on aarch64-linux-gnu, arm-linux-gnueabihf, and
> x86_64-linux-gnu.  OK for trunk?

OK.

Richard.

> Thanks,
> Alex
> 
> gcc/ChangeLog:
> 
>         * tree-vect-slp.cc (vect_build_slp_tree_2): In the two_operators
>         case, avoid setting the code field on the plus/minus nodes.
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri; (HRB 36809, AG Nuernberg)

Reply via email to