Patchwork Fix materialization wrt multiple decls with same assembler name

login
register
mail settings
Submitter H.J. Lu
Date Aug. 20, 2010, 2:43 p.m.
Message ID <AANLkTi=WWv=6k70VSB8AZNMEVZ9feFiSmMCx7Zo_9jBf@mail.gmail.com>
Download mbox | patch
Permalink /patch/62282/
State New
Headers show

Comments

H.J. Lu - Aug. 20, 2010, 2:43 p.m.
On Fri, Aug 20, 2010 at 7:36 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Aug 20, 2010 at 4:54 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Hi,
>> LTO sreaming in is reading in all function that do have corresponding sections
>> (based on assebmler name).
>>
>> This breaks when we have two decls with same assembler name (that is the case
>> of bultins). In this case we would attempt to read same body to two different
>> declarations that naturally breaks in many interesting ways and thus we test
>> DECL_IS_BUILTIN to avoid materialization.
>>
>> This test is just symptomatic, since it won't work with user aliases and such.
>> I am also running into problem with DECL_IS_BUILTIN returning true for all
>> compiler born functions since it test locator and UNKNOWN_LOCATION is considred
>> to be builtin.
>>
>> This patch changes lto_materialize_function to work out from callgraph if
>> function body is needed instead of checking presence of the section.  This is
>> the case when cgraph node is analyzed or when it have such clone.
>>
>> Bootstrapped/regtested x86_64, testing with mozilla build now, OK?
>>
>> Honza
>>
>>        * lto/lto.c (has_analyzed_clone_p): New function
>>        (lto_materialize_function): Use callgraph to determine if
>>        body is needed.
>>        (materialize_cgraph): Remove DECL_IS_BUILTIN check.
>
> Your checkin is different from you posted and caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45357
>

I checked in this as an obvious fix.
Jan Hubicka - Aug. 20, 2010, 3:04 p.m.
> 
> I checked in this as an obvious fix.

Thanks and my apologizes for the breakage.

Honza

Patch

Index: lto.c
===================================================================
--- lto.c	(revision 163404)
+++ lto.c	(working copy)
@@ -158,7 +158,7 @@  lto_materialize_function (struct cgraph_
   decl = node->decl;
   /* Read in functions with body (analyzed nodes)
      and also functions that are needed to produce virtual clones.  */
-  if (node->analyzed || has_analyzed_clone (node))
+  if (node->analyzed || has_analyzed_clone_p (node))
     {
       /* This function has a definition.  */
       TREE_STATIC (decl) = 1;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 163404)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2010-08-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bootstrap/45357
+	* lto.c (lto_materialize_function): Replace has_analyzed_clone
+	with has_analyzed_clone_p.
+
 2010-08-20  Jan Hubicka  <jh@suse.cz>

 	* lto.c (has_analyzed_clone_p): New function