diff mbox

[?/n] Cleanup LTO type merging

Message ID alpine.LNX.2.00.1105161615480.810@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener May 16, 2011, 2:17 p.m. UTC
The following patch improves hashing types by re-instantiating the
patch that makes us visit aggregate target types of pointers and
function return and argument types.  This halves the collision
rate on the type hash table for a linux-kernel build and improves
WPA compile-time from 3mins to 1mins and reduces memory usage by
1GB for that testcase.

Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
build-tested.

Richard.

(patch is reversed)

2011-05-16  Richard Guenther  <rguenther@suse.de>

	* gimple.c (iterative_hash_gimple_type): Re-instantiate
	change to always visit pointer target and function result
	and argument types.

Comments

H.J. Lu May 16, 2011, 9:27 p.m. UTC | #1
On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> The following patch improves hashing types by re-instantiating the
> patch that makes us visit aggregate target types of pointers and
> function return and argument types.  This halves the collision
> rate on the type hash table for a linux-kernel build and improves
> WPA compile-time from 3mins to 1mins and reduces memory usage by
> 1GB for that testcase.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
> build-tested.
>
> Richard.
>
> (patch is reversed)
>
> 2011-05-16  Richard Guenther  <rguenther@suse.de>
>
>        * gimple.c (iterative_hash_gimple_type): Re-instantiate
>        change to always visit pointer target and function result
>        and argument types.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013


H.J.
Richard Biener May 17, 2011, 10:29 a.m. UTC | #2
On Mon, 16 May 2011, H.J. Lu wrote:

> On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
> >
> > The following patch improves hashing types by re-instantiating the
> > patch that makes us visit aggregate target types of pointers and
> > function return and argument types.  This halves the collision
> > rate on the type hash table for a linux-kernel build and improves
> > WPA compile-time from 3mins to 1mins and reduces memory usage by
> > 1GB for that testcase.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
> > build-tested.
> >
> > Richard.
> >
> > (patch is reversed)
> >
> > 2011-05-16  Richard Guenther  <rguenther@suse.de>
> >
> >        * gimple.c (iterative_hash_gimple_type): Re-instantiate
> >        change to always visit pointer target and function result
> >        and argument types.
> >
> 
> This caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013

I have reverted the patch for now.

Richard.
H.J. Lu May 17, 2011, 12:59 p.m. UTC | #3
On Tue, May 17, 2011 at 3:29 AM, Richard Guenther <rguenther@suse.de> wrote:
> On Mon, 16 May 2011, H.J. Lu wrote:
>
>> On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
>> >
>> > The following patch improves hashing types by re-instantiating the
>> > patch that makes us visit aggregate target types of pointers and
>> > function return and argument types.  This halves the collision
>> > rate on the type hash table for a linux-kernel build and improves
>> > WPA compile-time from 3mins to 1mins and reduces memory usage by
>> > 1GB for that testcase.
>> >
>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
>> > build-tested.
>> >
>> > Richard.
>> >
>> > (patch is reversed)
>> >
>> > 2011-05-16  Richard Guenther  <rguenther@suse.de>
>> >
>> >        * gimple.c (iterative_hash_gimple_type): Re-instantiate
>> >        change to always visit pointer target and function result
>> >        and argument types.
>> >
>>
>> This caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>
> I have reverted the patch for now.
>

It doesn't solve the problem and I reopened:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013

Your followup patches may have similar issues.
H.J. Lu May 17, 2011, 1:01 p.m. UTC | #4
On Tue, May 17, 2011 at 5:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 17, 2011 at 3:29 AM, Richard Guenther <rguenther@suse.de> wrote:
>> On Mon, 16 May 2011, H.J. Lu wrote:
>>
>>> On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
>>> >
>>> > The following patch improves hashing types by re-instantiating the
>>> > patch that makes us visit aggregate target types of pointers and
>>> > function return and argument types.  This halves the collision
>>> > rate on the type hash table for a linux-kernel build and improves
>>> > WPA compile-time from 3mins to 1mins and reduces memory usage by
>>> > 1GB for that testcase.
>>> >
>>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
>>> > build-tested.
>>> >
>>> > Richard.
>>> >
>>> > (patch is reversed)
>>> >
>>> > 2011-05-16  Richard Guenther  <rguenther@suse.de>
>>> >
>>> >        * gimple.c (iterative_hash_gimple_type): Re-instantiate
>>> >        change to always visit pointer target and function result
>>> >        and argument types.
>>> >
>>>
>>> This caused:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>>
>> I have reverted the patch for now.
>>
>
> It doesn't solve the problem and I reopened:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>
> Your followup patches may have similar issues.
>

I think you reverted the WRONG patch:

http://gcc.gnu.org/viewcvs?view=revision&revision=173827
Richard Biener May 17, 2011, 1:03 p.m. UTC | #5
On Tue, May 17, 2011 at 3:01 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 17, 2011 at 5:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Tue, May 17, 2011 at 3:29 AM, Richard Guenther <rguenther@suse.de> wrote:
>>> On Mon, 16 May 2011, H.J. Lu wrote:
>>>
>>>> On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
>>>> >
>>>> > The following patch improves hashing types by re-instantiating the
>>>> > patch that makes us visit aggregate target types of pointers and
>>>> > function return and argument types.  This halves the collision
>>>> > rate on the type hash table for a linux-kernel build and improves
>>>> > WPA compile-time from 3mins to 1mins and reduces memory usage by
>>>> > 1GB for that testcase.
>>>> >
>>>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
>>>> > build-tested.
>>>> >
>>>> > Richard.
>>>> >
>>>> > (patch is reversed)
>>>> >
>>>> > 2011-05-16  Richard Guenther  <rguenther@suse.de>
>>>> >
>>>> >        * gimple.c (iterative_hash_gimple_type): Re-instantiate
>>>> >        change to always visit pointer target and function result
>>>> >        and argument types.
>>>> >
>>>>
>>>> This caused:
>>>>
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>>>
>>> I have reverted the patch for now.
>>>
>>
>> It doesn't solve the problem and I reopened:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>>
>> Your followup patches may have similar issues.
>>
>
> I think you reverted the WRONG patch:
>
> http://gcc.gnu.org/viewcvs?view=revision&revision=173827

No, that was on purpose.

> --
> H.J.
>
H.J. Lu May 17, 2011, 1:05 p.m. UTC | #6
On Tue, May 17, 2011 at 6:03 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, May 17, 2011 at 3:01 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Tue, May 17, 2011 at 5:59 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Tue, May 17, 2011 at 3:29 AM, Richard Guenther <rguenther@suse.de> wrote:
>>>> On Mon, 16 May 2011, H.J. Lu wrote:
>>>>
>>>>> On Mon, May 16, 2011 at 7:17 AM, Richard Guenther <rguenther@suse.de> wrote:
>>>>> >
>>>>> > The following patch improves hashing types by re-instantiating the
>>>>> > patch that makes us visit aggregate target types of pointers and
>>>>> > function return and argument types.  This halves the collision
>>>>> > rate on the type hash table for a linux-kernel build and improves
>>>>> > WPA compile-time from 3mins to 1mins and reduces memory usage by
>>>>> > 1GB for that testcase.
>>>>> >
>>>>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6
>>>>> > build-tested.
>>>>> >
>>>>> > Richard.
>>>>> >
>>>>> > (patch is reversed)
>>>>> >
>>>>> > 2011-05-16  Richard Guenther  <rguenther@suse.de>
>>>>> >
>>>>> >        * gimple.c (iterative_hash_gimple_type): Re-instantiate
>>>>> >        change to always visit pointer target and function result
>>>>> >        and argument types.
>>>>> >
>>>>>
>>>>> This caused:
>>>>>
>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>>>>
>>>> I have reverted the patch for now.
>>>>
>>>
>>> It doesn't solve the problem and I reopened:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49013
>>>
>>> Your followup patches may have similar issues.
>>>
>>
>> I think you reverted the WRONG patch:
>>
>> http://gcc.gnu.org/viewcvs?view=revision&revision=173827
>
> No, that was on purpose.
>

But it doesn't fix the problem.
diff mbox

Patch

Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 173725)
+++ gcc/gimple.c	(working copy)
@@ -4110,10 +4110,20 @@  iterative_hash_gimple_type (tree type, h
     }
 
   /* For pointer and reference types, fold in information about the type
-     pointed to.  */
+     pointed to but do not recurse into possibly incomplete types to
+     avoid hash differences for complete vs. incomplete types.  */
   if (POINTER_TYPE_P (type))
-    v = visit (TREE_TYPE (type), state, v,
-	       sccstack, sccstate, sccstate_obstack);
+    {
+      if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
+	{
+	  v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
+	  v = iterative_hash_name
+		(TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v);
+	}
+      else
+	v = visit (TREE_TYPE (type), state, v,
+		   sccstack, sccstate, sccstate_obstack);
+    }
 
   /* For integer types hash the types min/max values and the string flag.  */
   if (TREE_CODE (type) == INTEGER_TYPE)
@@ -4154,13 +4164,29 @@  iterative_hash_gimple_type (tree type, h
 	v = visit (TYPE_METHOD_BASETYPE (type), state, v,
 		   sccstack, sccstate, sccstate_obstack);
 
-      /* Check result and argument types.  */
-      v = visit (TREE_TYPE (type), state, v,
-		 sccstack, sccstate, sccstate_obstack);
+      /* For result types allow mismatch in completeness.  */
+      if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
+	{
+	  v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
+	  v = iterative_hash_name
+		(TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v);
+	}
+      else
+	v = visit (TREE_TYPE (type), state, v,
+		   sccstack, sccstate, sccstate_obstack);
+
       for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p))
 	{
-	  v = visit (TREE_VALUE (p), state, v,
-		     sccstack, sccstate, sccstate_obstack);
+	  /* For argument types allow mismatch in completeness.  */
+	  if (RECORD_OR_UNION_TYPE_P (TREE_VALUE (p)))
+	    {
+	      v = iterative_hash_hashval_t (TREE_CODE (TREE_VALUE (p)), v);
+	      v = iterative_hash_name
+		    (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_VALUE (p))), v);
+	    }
+	  else
+	    v = visit (TREE_VALUE (p), state, v,
+		       sccstack, sccstate, sccstate_obstack);
 	  na++;
 	}