diff mbox

Drop target_option_node reconstruction logic.

Message ID 20141114191315.GB6818@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Nov. 14, 2014, 7:13 p.m. UTC
Hi,
this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
attributes.  This code was never complete and it should be no-op now when we save
tehe target nodes.
It also makes free_land_data_in_decl to actually anotate all function bodies with
a default option node.  The reason is that when LTOint units, one compiled with
default settings and one, say with -msse3, we want ot keep these functions preserved.

Incrementally i will proceed with similar changes for optimization nodes.

Bootstrapped/regtested ppc64-linux, earlier version tested at x86_64-linux and
firefox LTO, OK?

Honza

	* lto.c (lto_read_decls): Do not rebuild DECL_FUNCTION_SPECIFIC_TARGET.
	* tree.c (free_lang_data_in_decl): Annotate all functio nbodies with
	DECL_FUNCTION_SPECIFIC_TARGET.

Comments

Markus Trippelsdorf Nov. 14, 2014, 7:52 p.m. UTC | #1
On 2014.11.14 at 20:13 +0100, Jan Hubicka wrote:
> this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
> attributes.  This code was never complete and it should be no-op now when we save
> tehe target nodes.
> It also makes free_land_data_in_decl to actually anotate all function bodies with
> a default option node.  The reason is that when LTOint units, one compiled with
> default settings and one, say with -msse3, we want ot keep these functions preserved.

FYI this patch finally fixes: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60607

Thanks.
Jan Hubicka Nov. 14, 2014, 8:01 p.m. UTC | #2
> On 2014.11.14 at 20:13 +0100, Jan Hubicka wrote:
> > this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
> > attributes.  This code was never complete and it should be no-op now when we save
> > tehe target nodes.
> > It also makes free_land_data_in_decl to actually anotate all function bodies with
> > a default option node.  The reason is that when LTOint units, one compiled with
> > default settings and one, say with -msse3, we want ot keep these functions preserved.
> 
> FYI this patch finally fixes: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60607

Yes, properly combining different target flags was the main motivation (so we
get correct LTO for firefox :) Still hope to be able to finish the
optimization_node part, so combining other flags will work as expected.

If you could turn this into a testcase, it would be cool.

Honza
> 
> Thanks.
> -- 
> Markus
Richard Biener Nov. 15, 2014, 9:43 a.m. UTC | #3
On November 14, 2014 8:13:15 PM CET, Jan Hubicka <hubicka@ucw.cz> wrote:
>Hi,
>this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET
>from target
>attributes.  This code was never complete and it should be no-op now
>when we save
>tehe target nodes.
>It also makes free_land_data_in_decl to actually anotate all function
>bodies with
>a default option node.  The reason is that when LTOint units, one
>compiled with
>default settings and one, say with -msse3, we want ot keep these
>functions preserved.
>
>Incrementally i will proceed with similar changes for optimization
>nodes.
>
>Bootstrapped/regtested ppc64-linux, earlier version tested at
>x86_64-linux and
>firefox LTO, OK?

OK.

Thanks,
Richard.

>Honza
>
>	* lto.c (lto_read_decls): Do not rebuild
>DECL_FUNCTION_SPECIFIC_TARGET.
>	* tree.c (free_lang_data_in_decl): Annotate all functio nbodies with
>	DECL_FUNCTION_SPECIFIC_TARGET.
>Index: lto/lto.c
>===================================================================
>--- lto/lto.c	(revision 217571)
>+++ lto/lto.c	(working copy)
>@@ -1935,15 +1935,6 @@
> 	      if (TREE_CODE (t) == INTEGER_CST
> 		  && !TREE_OVERFLOW (t))
> 		cache_integer_cst (t);
>-	      /* Re-build DECL_FUNCTION_SPECIFIC_TARGET, we need that
>-	         for both WPA and LTRANS stage.  */
>-	      if (TREE_CODE (t) == FUNCTION_DECL)
>-		{
>-		  tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (t));
>-		  if (attr)
>-		    targetm.target_option.valid_attribute_p
>-			(t, NULL_TREE, TREE_VALUE (attr), 0);
>-		}
> 	      /* Register TYPE_DECLs with the debuginfo machinery.  */
> 	      if (!flag_wpa
> 		  && TREE_CODE (t) == TYPE_DECL)
>Index: tree.c
>===================================================================
>--- tree.c	(revision 217571)
>+++ tree.c	(working copy)
>@@ -5115,6 +5115,9 @@
> 	     the PARM_DECL will be used in the function's body).  */
> 	  for (t = DECL_ARGUMENTS (decl); t; t = TREE_CHAIN (t))
> 	    DECL_CONTEXT (t) = decl;
>+	  if (!DECL_FUNCTION_SPECIFIC_TARGET (decl))
>+	    DECL_FUNCTION_SPECIFIC_TARGET (decl)
>+	      = target_option_default_node;
> 	}
> 
>       /* DECL_SAVED_TREE holds the GENERIC representation for DECL.
H.J. Lu Nov. 19, 2014, 3:37 p.m. UTC | #4
On Fri, Nov 14, 2014 at 11:13 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
> attributes.  This code was never complete and it should be no-op now when we save
> tehe target nodes.
> It also makes free_land_data_in_decl to actually anotate all function bodies with
> a default option node.  The reason is that when LTOint units, one compiled with
> default settings and one, say with -msse3, we want ot keep these functions preserved.
>
> Incrementally i will proceed with similar changes for optimization nodes.
>
> Bootstrapped/regtested ppc64-linux, earlier version tested at x86_64-linux and
> firefox LTO, OK?
>
> Honza
>
>         * lto.c (lto_read_decls): Do not rebuild DECL_FUNCTION_SPECIFIC_TARGET.
>         * tree.c (free_lang_data_in_decl): Annotate all functio nbodies with
>         DECL_FUNCTION_SPECIFIC_TARGET.

It caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63917
Jan Hubicka Nov. 19, 2014, 6:11 p.m. UTC | #5
> On Fri, Nov 14, 2014 at 11:13 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
nz
> > Hi,
> > this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
> > attributes.  This code was never complete and it should be no-op now when we save
> > tehe target nodes.
> > It also makes free_land_data_in_decl to actually anotate all function bodies with
> > a default option node.  The reason is that when LTOint units, one compiled with
> > default settings and one, say with -msse3, we want ot keep these functions preserved.
> >
> > Incrementally i will proceed with similar changes for optimization nodes.
> >
> > Bootstrapped/regtested ppc64-linux, earlier version tested at x86_64-linux and
> > firefox LTO, OK?
> >
> > Honza
> >
> >         * lto.c (lto_read_decls): Do not rebuild DECL_FUNCTION_SPECIFIC_TARGET.
> >         * tree.c (free_lang_data_in_decl): Annotate all functio nbodies with
> >         DECL_FUNCTION_SPECIFIC_TARGET.
> 
> It caused:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63917
This one seems to be abou ifcft change by Zhenqiang?

Honza
> 
> -- 
> H.J.
H.J. Lu Nov. 19, 2014, 6:39 p.m. UTC | #6
On Wed, Nov 19, 2014 at 10:11 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On Fri, Nov 14, 2014 at 11:13 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> nz
>> > Hi,
>> > this patch kills lto's code to rebuilt DECL_FUNCTION_SPECIFIC_TARGET from target
>> > attributes.  This code was never complete and it should be no-op now when we save
>> > tehe target nodes.
>> > It also makes free_land_data_in_decl to actually anotate all function bodies with
>> > a default option node.  The reason is that when LTOint units, one compiled with
>> > default settings and one, say with -msse3, we want ot keep these functions preserved.
>> >
>> > Incrementally i will proceed with similar changes for optimization nodes.
>> >
>> > Bootstrapped/regtested ppc64-linux, earlier version tested at x86_64-linux and
>> > firefox LTO, OK?
>> >
>> > Honza
>> >
>> >         * lto.c (lto_read_decls): Do not rebuild DECL_FUNCTION_SPECIFIC_TARGET.
>> >         * tree.c (free_lang_data_in_decl): Annotate all functio nbodies with
>> >         DECL_FUNCTION_SPECIFIC_TARGET.
>>
>> It caused:
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63917
> This one seems to be abou ifcft change by Zhenqiang?
>
> Honza
>>
>> --
>> H.J.

Oops. I meant:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63967
diff mbox

Patch

Index: lto/lto.c
===================================================================
--- lto/lto.c	(revision 217571)
+++ lto/lto.c	(working copy)
@@ -1935,15 +1935,6 @@ 
 	      if (TREE_CODE (t) == INTEGER_CST
 		  && !TREE_OVERFLOW (t))
 		cache_integer_cst (t);
-	      /* Re-build DECL_FUNCTION_SPECIFIC_TARGET, we need that
-	         for both WPA and LTRANS stage.  */
-	      if (TREE_CODE (t) == FUNCTION_DECL)
-		{
-		  tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (t));
-		  if (attr)
-		    targetm.target_option.valid_attribute_p
-			(t, NULL_TREE, TREE_VALUE (attr), 0);
-		}
 	      /* Register TYPE_DECLs with the debuginfo machinery.  */
 	      if (!flag_wpa
 		  && TREE_CODE (t) == TYPE_DECL)
Index: tree.c
===================================================================
--- tree.c	(revision 217571)
+++ tree.c	(working copy)
@@ -5115,6 +5115,9 @@ 
 	     the PARM_DECL will be used in the function's body).  */
 	  for (t = DECL_ARGUMENTS (decl); t; t = TREE_CHAIN (t))
 	    DECL_CONTEXT (t) = decl;
+	  if (!DECL_FUNCTION_SPECIFIC_TARGET (decl))
+	    DECL_FUNCTION_SPECIFIC_TARGET (decl)
+	      = target_option_default_node;
 	}
 
       /* DECL_SAVED_TREE holds the GENERIC representation for DECL.