PR lto/44812 (missing indirections on Darwin)

Submitted by Jan Hubicka on Sept. 3, 2010, 11:15 a.m.

Details

Message ID 20100903111531.GO1664@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Sept. 3, 2010, 11:15 a.m.
Hi,
WHOPR partitioning confused darwin, since function/variables from other partitions are declared
as !DECL_EXTERNAL. This works on elf target as there is no difference in referring symbol
in current .s file or known to be in current DSO.

The patch caused missed optimization in constant folding I fixed now, but still when I compile
Mozilla, i get code size increase 23815472 to 23882616 (on x86_64-linux).
I found some other cases where we miss initializer fodling in expr.c triggering during bootstrap
and I am in progress of fixing this.  I guess the regression is tiny enough so we ought to fix
the correctness issue.

Bootstrapped/regtested x86_64-linux (and tested to fix Darwin's issues)
OK?
Honza

	PR lto/44812
	* lto-cgraph.c (intput_node, input_varpool_node): Set DECL_EXTERNAL
	on functions/variables in other partition.

Comments

Richard Guenther Sept. 3, 2010, 11:24 a.m.
On Fri, 3 Sep 2010, Jan Hubicka wrote:

> Hi,
> WHOPR partitioning confused darwin, since function/variables from other partitions are declared
> as !DECL_EXTERNAL. This works on elf target as there is no difference in referring symbol
> in current .s file or known to be in current DSO.
> 
> The patch caused missed optimization in constant folding I fixed now, but still when I compile
> Mozilla, i get code size increase 23815472 to 23882616 (on x86_64-linux).
> I found some other cases where we miss initializer fodling in expr.c triggering during bootstrap
> and I am in progress of fixing this.  I guess the regression is tiny enough so we ought to fix
> the correctness issue.
> 
> Bootstrapped/regtested x86_64-linux (and tested to fix Darwin's issues)
> OK?

Ok.

THanks,
Richard.

> Honza
> 
> 	PR lto/44812
> 	* lto-cgraph.c (intput_node, input_varpool_node): Set DECL_EXTERNAL
> 	on functions/variables in other partition.
> --- lto-cgraph.c	2010-09-03 12:12:36.000000000 +0200
> +++ lto-cgraph.c1	2010-09-03 12:10:43.000000000 +0200
> @@ -953,6 +953,11 @@
>    node->lowered = bp_unpack_value (bp, 1);
>    node->analyzed = tag == LTO_cgraph_analyzed_node;
>    node->in_other_partition = bp_unpack_value (bp, 1);
> +  if (node->in_other_partition)
> +    {
> +      DECL_EXTERNAL (node->decl) = 1;
> +      TREE_STATIC (node->decl) = 0;
> +    }
>    node->alias = bp_unpack_value (bp, 1);
>    node->finalized_by_frontend = bp_unpack_value (bp, 1);
>    node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
> @@ -1111,6 +1116,11 @@
>    node->analyzed = node->finalized; 
>    node->used_from_other_partition = bp_unpack_value (&bp, 1);
>    node->in_other_partition = bp_unpack_value (&bp, 1);
> +  if (node->in_other_partition)
> +    {
> +      DECL_EXTERNAL (node->decl) = 1;
> +      TREE_STATIC (node->decl) = 0;
> +    }
>    aliases_p = bp_unpack_value (&bp, 1);
>    if (node->finalized)
>      varpool_mark_needed_node (node);
> 
>

Patch hide | download patch | download mbox

--- lto-cgraph.c	2010-09-03 12:12:36.000000000 +0200
+++ lto-cgraph.c1	2010-09-03 12:10:43.000000000 +0200
@@ -953,6 +953,11 @@ 
   node->lowered = bp_unpack_value (bp, 1);
   node->analyzed = tag == LTO_cgraph_analyzed_node;
   node->in_other_partition = bp_unpack_value (bp, 1);
+  if (node->in_other_partition)
+    {
+      DECL_EXTERNAL (node->decl) = 1;
+      TREE_STATIC (node->decl) = 0;
+    }
   node->alias = bp_unpack_value (bp, 1);
   node->finalized_by_frontend = bp_unpack_value (bp, 1);
   node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
@@ -1111,6 +1116,11 @@ 
   node->analyzed = node->finalized; 
   node->used_from_other_partition = bp_unpack_value (&bp, 1);
   node->in_other_partition = bp_unpack_value (&bp, 1);
+  if (node->in_other_partition)
+    {
+      DECL_EXTERNAL (node->decl) = 1;
+      TREE_STATIC (node->decl) = 0;
+    }
   aliases_p = bp_unpack_value (&bp, 1);
   if (node->finalized)
     varpool_mark_needed_node (node);