diff mbox

[GOOGLE] Refine LIPO aux function removal

Message ID CAAe5K+UTk9CmGSfmxerFgXn6tDRq7CVGu51F4CvCHQWNpvrGUA@mail.gmail.com
State New
Headers show

Commit Message

Teresa Johnson Jan. 3, 2015, 6:19 a.m. UTC
Fixes a problem caused by my recent change to allow aux functions to
be removed. They need to be kept until after LIPO linking/static
promotion, since they affect the promoted names of any static
variables defined within their context.

Passes regression and internal testing. Ok for google/4_9?

Thanks,
Teresa

2015-01-02  Teresa Johnson  <tejohnson@google.com>

        Google ref b/18882262.
        * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep
        aux functions until after LIPO linking.

Comments

Xinliang David Li Jan. 3, 2015, 6:27 a.m. UTC | #1
ok.

David

On Fri, Jan 2, 2015 at 10:19 PM, Teresa Johnson <tejohnson@google.com> wrote:
> Fixes a problem caused by my recent change to allow aux functions to
> be removed. They need to be kept until after LIPO linking/static
> promotion, since they affect the promoted names of any static
> variables defined within their context.
>
> Passes regression and internal testing. Ok for google/4_9?
>
> Thanks,
> Teresa
>
> 2015-01-02  Teresa Johnson  <tejohnson@google.com>
>
>         Google ref b/18882262.
>         * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep
>         aux functions until after LIPO linking.
>
> Index: cgraph.c
> ===================================================================
> --- cgraph.c    (revision 219100)
> +++ cgraph.c    (working copy)
> @@ -2462,8 +2462,13 @@ cgraph_can_remove_if_no_direct_calls_and_refs_p (s
>  {
>    gcc_assert (!node->global.inlined_to);
>    /* Extern inlines can always go, we will use the external definition.  */
> -  if (DECL_EXTERNAL (node->decl) || cgraph_is_aux_decl_external (node))
> +  if (DECL_EXTERNAL (node->decl))
>      return true;
> +  /* Aux functions are safe to remove, but only once static promotion is
> +     complete since they may affect promoted names if they are the context
> +     for any static variables.  */
> +  if (cgraph_pre_profiling_inlining_done && cgraph_is_aux_decl_external (node))
> +    return true;
>    /* When function is needed, we can not remove it.  */
>    if (node->force_output || node->used_from_other_partition)
>      return false;
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
diff mbox

Patch

Index: cgraph.c
===================================================================
--- cgraph.c    (revision 219100)
+++ cgraph.c    (working copy)
@@ -2462,8 +2462,13 @@  cgraph_can_remove_if_no_direct_calls_and_refs_p (s
 {
   gcc_assert (!node->global.inlined_to);
   /* Extern inlines can always go, we will use the external definition.  */
-  if (DECL_EXTERNAL (node->decl) || cgraph_is_aux_decl_external (node))
+  if (DECL_EXTERNAL (node->decl))
     return true;
+  /* Aux functions are safe to remove, but only once static promotion is
+     complete since they may affect promoted names if they are the context
+     for any static variables.  */
+  if (cgraph_pre_profiling_inlining_done && cgraph_is_aux_decl_external (node))
+    return true;
   /* When function is needed, we can not remove it.  */
   if (node->force_output || node->used_from_other_partition)
     return false;