Fix lto/uniq_const testcase

Richard Guenther richard.guenther@gmail.com
Fri Apr 30 09:54:00 GMT 2010


On Fri, Apr 30, 2010 at 11:51 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> uni-const testcase fails because we produce constant pool initializer for the
> array and unify it across multiple compilation units.  Then we attempt to make
> its symbol public, but because it is using internal label, we fail to link.
>
> This patch solve the problem by keeping constant pools local to each ltrans.
> At -Os we may want to revisit this in future.  OK?

Ok.

Thanks,
Richard.

> Bootstrapped/regtested x86_64-linux.
>
>        * lto-cgraph.c (lto_output_varpool_node): Always output constant pool
>        references.
>
>        * lto.c: Do not attempt to make constant pool references global.
> Index: lto-cgraph.c
> ===================================================================
> --- lto-cgraph.c        (revision 158926)
> +++ lto-cgraph.c        (working copy)
> @@ -375,10 +375,21 @@ lto_output_varpool_node (struct lto_simp
>   gcc_assert (node->finalized || !node->analyzed);
>   gcc_assert (node->needed);
>   gcc_assert (!node->alias);
> -  /* FIXME: We have no idea how we move references around.  For moment assume that
> -     everything is used externally.  */
> -  bp_pack_value (bp, flag_wpa, 1);  /* used_from_other_parition.  */
> -  bp_pack_value (bp, boundary_p, 1);  /* in_other_partition.  */
> +  /* Constant pool initializers can be de-unified into individual ltrans units.
> +     FIXME: Alternatively at -Os we may want to avoid generating for them the local
> +     labels and share them across LTRANS partitions.  */
> +  if (DECL_IN_CONSTANT_POOL (node->decl))
> +    {
> +      bp_pack_value (bp, 0, 1);  /* used_from_other_parition.  */
> +      bp_pack_value (bp, 0, 1);  /* in_other_partition.  */
> +    }
> +  else
> +    {
> +      /* FIXME: We have no idea how we move references around.  For moment assume that
> +        everything is used externally.  */
> +      bp_pack_value (bp, flag_wpa, 1);  /* used_from_other_parition.  */
> +      bp_pack_value (bp, boundary_p, 1);  /* in_other_partition.  */
> +    }
>   /* Also emit any extra name aliases.  */
>   for (alias = node->extra_name; alias; alias = alias->next)
>     count++;
> Index: lto/lto.c
> ===================================================================
> --- lto/lto.c   (revision 158925)
> +++ lto/lto.c   (working copy)
> @@ -723,9 +723,13 @@ lto_promote_cross_file_statics (void)
>   gcc_assert (flag_wpa);
>
>   /* At moment we make no attempt to figure out who is refering the variables,
> -     so all must become global.  */
> +     so all must become global.
> +
> +     Constant pool references use internal labels and thus can not be made global.
> +     It is sensible to keep those ltrans local to allow better optimization.  */
>   for (vnode = varpool_nodes; vnode; vnode = vnode->next)
> -    if (!vnode->externally_visible && vnode->analyzed)
> +    if (!vnode->externally_visible && vnode->analyzed
> +       && !DECL_IN_CONSTANT_POOL (vnode->decl))
>        {
>          TREE_PUBLIC (vnode->decl) = 1;
>          DECL_VISIBILITY (vnode->decl) = VISIBILITY_HIDDEN;
>



More information about the Gcc-patches mailing list