From patchwork Fri Sep 3 11:15:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PR lto/44812 (missing indirections on Darwin) Date: Fri, 03 Sep 2010 01:15:31 -0000 From: Jan Hubicka X-Patchwork-Id: 63671 Message-Id: <20100903111531.GO1664@kam.mff.cuni.cz> To: gcc-patches@gcc.gnu.org, rguenther@suse.de, rth@redhat.com, dnovillo@google.com 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. --- 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);