This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use RECORD_OR_UNION_TYPE_P for TYPE_TRANSPARENT_AGGR guarding (was Re: [PATCH] Fix ICE with TYPE_TRANSPARENT_AGGR (PR middle-end/91001))
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 6 Sep 2019 10:40:33 +0200 (CEST)
- Subject: Re: [PATCH] Use RECORD_OR_UNION_TYPE_P for TYPE_TRANSPARENT_AGGR guarding (was Re: [PATCH] Fix ICE with TYPE_TRANSPARENT_AGGR (PR middle-end/91001))
- References: <20190905091228.GB2120@tucnak> <CD741C9A-7926-475D-AB7A-ADC504FAB767@gmail.com> <20190906073912.GE2120@tucnak>
On Fri, 6 Sep 2019, Jakub Jelinek wrote:
> Hi!
>
> On Thu, Sep 05, 2019 at 08:40:35PM +0200, Bernhard Reutner-Fischer wrote:
> > >@@ -2771,6 +2771,11 @@ load_register_parameters (struct arg_dat
> > > poly_int64 size = 0;
> > > HOST_WIDE_INT const_size = 0;
> > > rtx_insn *before_arg = get_last_insn ();
> > >+ tree type = TREE_TYPE (args[i].tree_value);
> > >+ if ((TREE_CODE (type) == UNION_TYPE
> > >+ || TREE_CODE (type) == RECORD_TYPE)
> >
> > RECORD_OR_UNION_TYPE_P ?
> > That would include QUAL_UNION_TYPE ..
>
> I guess we can do that, we use that guard elsewhere too. I think nothing
> right now sets TYPE_TRANSPARENT_AGGR on QUAL_UNION_TYPE, but as the 3 are
> next to each other, for optimized compiler it should make no compile time
> difference.
> There are two spots that were checking just for RECORD_TYPE with
> TYPE_TRANSPARENT_AGGR, I believe that is something to handle std::decimal*
> and I have left it as is.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK.
> 2019-09-06 Jakub Jelinek <jakub@redhat.com>
>
> * function.c (assign_parm_find_data_types): Use RECORD_OR_UNION_TYPE_P
> before testing TYPE_TRANSPARENT_AGGR.
> * calls.c (initialize_argument_information, load_register_parameters):
> Likewise.
>
> --- gcc/function.c.jj 2019-08-29 10:22:19.573503198 +0200
> +++ gcc/function.c 2019-09-05 22:04:49.911484885 +0200
> @@ -2443,8 +2443,7 @@ assign_parm_find_data_types (struct assi
> /* If the parm is to be passed as a transparent union or record, use the
> type of the first field for the tests below. We have already verified
> that the modes are the same. */
> - if ((TREE_CODE (data->arg.type) == UNION_TYPE
> - || TREE_CODE (data->arg.type) == RECORD_TYPE)
> + if (RECORD_OR_UNION_TYPE_P (data->arg.type)
> && TYPE_TRANSPARENT_AGGR (data->arg.type))
> data->arg.type = TREE_TYPE (first_field (data->arg.type));
>
> --- gcc/calls.c.jj 2019-09-05 15:29:45.432252481 +0200
> +++ gcc/calls.c 2019-09-05 22:04:10.744072074 +0200
> @@ -1991,8 +1991,7 @@ initialize_argument_information (int num
> /* If TYPE is a transparent union or record, pass things the way
> we would pass the first field of the union or record. We have
> already verified that the modes are the same. */
> - if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE)
> - && TYPE_TRANSPARENT_AGGR (type))
> + if (RECORD_OR_UNION_TYPE_P (type) && TYPE_TRANSPARENT_AGGR (type))
> type = TREE_TYPE (first_field (type));
>
> /* Decide where to pass this arg.
> @@ -2772,9 +2771,7 @@ load_register_parameters (struct arg_dat
> HOST_WIDE_INT const_size = 0;
> rtx_insn *before_arg = get_last_insn ();
> tree type = TREE_TYPE (args[i].tree_value);
> - if ((TREE_CODE (type) == UNION_TYPE
> - || TREE_CODE (type) == RECORD_TYPE)
> - && TYPE_TRANSPARENT_AGGR (type))
> + if (RECORD_OR_UNION_TYPE_P (type) && TYPE_TRANSPARENT_AGGR (type))
> type = TREE_TYPE (first_field (type));
> /* Set non-negative if we must move a word at a time, even if
> just one word (e.g, partial == 4 && mode == DFmode). Set
>
>
> Jakub
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 247165 (AG München)