diff mbox

Drop TYPE_NEEDS_CONSTRUCTING checks from ipa-pure-const and tree-inline

Message ID 20150614223000.GA36639@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka June 14, 2015, 10:30 p.m. UTC
Hi,
this patch removes last two remaining uses of TYPE_NEEDS_CONSTRUCTING
in the back-end.  I believe those are remainders from the time we did not
gimplify as much as we do now. Alias analysis machinery already skips
checks of TYPE_NEEDS_CONSTRUCTING and thus we need to mark tree correctly
as non-readonly if it is constructed.

Incrementally I would like to remove TYPE_NEEDS_CONSTRUCTING streaming
and clear it in free_lang_data.

Bootstrapped/regtested ppc64le-linux, OK?

Honza

	* ipa-pure-const.c (check_decl): Do not check TYPE_NEEDS_CONSTRUCTING.
	* tree-inline.c (setup_one_parameter): Likewise.

Comments

Richard Biener June 16, 2015, 1:47 p.m. UTC | #1
On Mon, 15 Jun 2015, Jan Hubicka wrote:

> Hi,
> this patch removes last two remaining uses of TYPE_NEEDS_CONSTRUCTING
> in the back-end.  I believe those are remainders from the time we did not
> gimplify as much as we do now. Alias analysis machinery already skips
> checks of TYPE_NEEDS_CONSTRUCTING and thus we need to mark tree correctly
> as non-readonly if it is constructed.

I think it is relevant only for globals anyway, no?  Thus with
unit-at-a-time and global constructors built we should even see it
is not readonly.

> Incrementally I would like to remove TYPE_NEEDS_CONSTRUCTING streaming
> and clear it in free_lang_data.
> 
> Bootstrapped/regtested ppc64le-linux, OK?

Ok.

Thanks,
Richard.

> Honza
> 
> 	* ipa-pure-const.c (check_decl): Do not check TYPE_NEEDS_CONSTRUCTING.
> 	* tree-inline.c (setup_one_parameter): Likewise.
> Index: ipa-pure-const.c
> ===================================================================
> --- ipa-pure-const.c	(revision 224463)
> +++ ipa-pure-const.c	(working copy)
> @@ -335,7 +335,7 @@
>    if (DECL_EXTERNAL (t) || TREE_PUBLIC (t))
>      {
>        /* Readonly reads are safe.  */
> -      if (TREE_READONLY (t) && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t)))
> +      if (TREE_READONLY (t))
>  	return; /* Read of a constant, do not change the function state.  */
>        else
>  	{
> Index: tree-inline.c
> ===================================================================
> --- tree-inline.c	(revision 224463)
> +++ tree-inline.c	(working copy)
> @@ -3151,18 +3151,6 @@
>       automatically replaced by the VAR_DECL.  */
>    insert_decl_map (id, p, var);
>  
> -  /* Even if P was TREE_READONLY, the new VAR should not be.
> -     In the original code, we would have constructed a
> -     temporary, and then the function body would have never
> -     changed the value of P.  However, now, we will be
> -     constructing VAR directly.  The constructor body may
> -     change its value multiple times as it is being
> -     constructed.  Therefore, it must not be TREE_READONLY;
> -     the back-end assumes that TREE_READONLY variable is
> -     assigned to only once.  */
> -  if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
> -    TREE_READONLY (var) = 0;
> -
>    /* If there is no setup required and we are in SSA, take the easy route
>       replacing all SSA names representing the function parameter by the
>       SSA name passed to function.
> 
>
Jan Hubicka June 16, 2015, 10:43 p.m. UTC | #2
> On Mon, 15 Jun 2015, Jan Hubicka wrote:
> 
> > Hi,
> > this patch removes last two remaining uses of TYPE_NEEDS_CONSTRUCTING
> > in the back-end.  I believe those are remainders from the time we did not
> > gimplify as much as we do now. Alias analysis machinery already skips
> > checks of TYPE_NEEDS_CONSTRUCTING and thus we need to mark tree correctly
> > as non-readonly if it is constructed.
> 
> I think it is relevant only for globals anyway, no?  Thus with
> unit-at-a-time and global constructors built we should even see it
> is not readonly.

Yes, I believe this is all lowered now.
> 
> > Incrementally I would like to remove TYPE_NEEDS_CONSTRUCTING streaming
> > and clear it in free_lang_data.
> > 
> > Bootstrapped/regtested ppc64le-linux, OK?
> 
> Ok.

Thanks! One bit fewer to care about :)

Honza
diff mbox

Patch

Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c	(revision 224463)
+++ ipa-pure-const.c	(working copy)
@@ -335,7 +335,7 @@ 
   if (DECL_EXTERNAL (t) || TREE_PUBLIC (t))
     {
       /* Readonly reads are safe.  */
-      if (TREE_READONLY (t) && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t)))
+      if (TREE_READONLY (t))
 	return; /* Read of a constant, do not change the function state.  */
       else
 	{
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 224463)
+++ tree-inline.c	(working copy)
@@ -3151,18 +3151,6 @@ 
      automatically replaced by the VAR_DECL.  */
   insert_decl_map (id, p, var);
 
-  /* Even if P was TREE_READONLY, the new VAR should not be.
-     In the original code, we would have constructed a
-     temporary, and then the function body would have never
-     changed the value of P.  However, now, we will be
-     constructing VAR directly.  The constructor body may
-     change its value multiple times as it is being
-     constructed.  Therefore, it must not be TREE_READONLY;
-     the back-end assumes that TREE_READONLY variable is
-     assigned to only once.  */
-  if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
-    TREE_READONLY (var) = 0;
-
   /* If there is no setup required and we are in SSA, take the easy route
      replacing all SSA names representing the function parameter by the
      SSA name passed to function.