Clear TYPELESS_STORAGE when turning type to incmplete

2018-11-06 Thread Jan Hubicka
Hi,
this patch adds code to clear typeless storage flag. This is needed to
enable some more merging for C++ types containing char array.

Bootstrapped/regtesed x86_64-linux, OK?

Honza

* tree.c (fld_incomplete_type_of): Clear TYPE_TYPELESS_STORAGE
flag.
Index: tree.c
===
--- tree.c  (revision 265835)
+++ tree.c  (working copy)
@@ -5173,6 +5173,7 @@ fld_incomplete_type_of (tree t, struct f
  SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
  TYPE_SIZE_UNIT (copy) = NULL;
  TYPE_CANONICAL (copy) = TYPE_CANONICAL (t);
+ TYPE_TYPELESS_STORAGE (copy) = 0;
  if (AGGREGATE_TYPE_P (t))
{
  TYPE_FIELDS (copy) = NULL;


Re: Clear TYPELESS_STORAGE when turning type to incmplete

2018-11-06 Thread Richard Biener
On Tue, 6 Nov 2018, Jan Hubicka wrote:

> Hi,
> this patch adds code to clear typeless storage flag. This is needed to
> enable some more merging for C++ types containing char array.
>
> Bootstrapped/regtesed x86_64-linux, OK?

OK.  (I guess we could equally well set it to 1?)

Richard.
 
> Honza
> 
>   * tree.c (fld_incomplete_type_of): Clear TYPE_TYPELESS_STORAGE
>   flag.
> Index: tree.c
> ===
> --- tree.c(revision 265835)
> +++ tree.c(working copy)
> @@ -5173,6 +5173,7 @@ fld_incomplete_type_of (tree t, struct f
> SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
> TYPE_SIZE_UNIT (copy) = NULL;
> TYPE_CANONICAL (copy) = TYPE_CANONICAL (t);
> +   TYPE_TYPELESS_STORAGE (copy) = 0;
> if (AGGREGATE_TYPE_P (t))
>   {
> TYPE_FIELDS (copy) = NULL;
> 
> 

-- 
Richard Biener 
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)


Re: Clear TYPELESS_STORAGE when turning type to incmplete

2018-11-06 Thread Jan Hubicka
> On Tue, 6 Nov 2018, Jan Hubicka wrote:
> 
> > Hi,
> > this patch adds code to clear typeless storage flag. This is needed to
> > enable some more merging for C++ types containing char array.
> >
> > Bootstrapped/regtesed x86_64-linux, OK?
> 
> OK.  (I guess we could equally well set it to 1?)

Then we would need to set it for front-end built incomplete types as
well. Whatever I construct in here should better match real incomplete
type built by front-ends otherwise merging of other types referring to
this one via pointers won't happen.

Honza

> 
> Richard.
>  
> > Honza
> > 
> > * tree.c (fld_incomplete_type_of): Clear TYPE_TYPELESS_STORAGE
> > flag.
> > Index: tree.c
> > ===
> > --- tree.c  (revision 265835)
> > +++ tree.c  (working copy)
> > @@ -5173,6 +5173,7 @@ fld_incomplete_type_of (tree t, struct f
> >   SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
> >   TYPE_SIZE_UNIT (copy) = NULL;
> >   TYPE_CANONICAL (copy) = TYPE_CANONICAL (t);
> > + TYPE_TYPELESS_STORAGE (copy) = 0;
> >   if (AGGREGATE_TYPE_P (t))
> > {
> >   TYPE_FIELDS (copy) = NULL;
> > 
> > 
> 
> -- 
> Richard Biener 
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
> 21284 (AG Nuernberg)


Re: Clear TYPELESS_STORAGE when turning type to incmplete

2018-11-06 Thread Richard Biener
On Tue, 6 Nov 2018, Jan Hubicka wrote:

> > On Tue, 6 Nov 2018, Jan Hubicka wrote:
> > 
> > > Hi,
> > > this patch adds code to clear typeless storage flag. This is needed to
> > > enable some more merging for C++ types containing char array.
> > >
> > > Bootstrapped/regtesed x86_64-linux, OK?
> > 
> > OK.  (I guess we could equally well set it to 1?)
> 
> Then we would need to set it for front-end built incomplete types as
> well. Whatever I construct in here should better match real incomplete
> type built by front-ends otherwise merging of other types referring to
> this one via pointers won't happen.

Ah, of course.

Richard.