diff mbox

[GOOGLE] Skip fake LIPO edges when replacing calls with local alias

Message ID CAAe5K+X3PdZ4a_g6Rf1=QELUG8d-Q08HyMs3bTA-EjEVH17LqQ@mail.gmail.com
State New
Headers show

Commit Message

Teresa Johnson Oct. 3, 2014, 4:27 p.m. UTC
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.

Passes regression tests, ok for google/4_9 branch?

Teresa

2014-10-03  Teresa Johnson  <tejohnson@google.com>

        Google ref b/17378050
        * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
        call edges.

                  if (gimple_has_body_p (e->caller->decl))

Comments

Xinliang David Li Oct. 3, 2014, 4:31 p.m. UTC | #1
The name 'e' is used for both outer scope edge and inner scope one.
This is confusing.

David


On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson <tejohnson@google.com> wrote:
> Adds handling in this block of code (new in gcc/4_9 and therefore
> google/4_9) for LIPO fake edges for indirect calls, which don't have a
> call_stmt set and cannot be redirected.
>
> Passes regression tests, ok for google/4_9 branch?
>
> Teresa
>
> 2014-10-03  Teresa Johnson  <tejohnson@google.com>
>
>         Google ref b/17378050
>         * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
>         call edges.
>
> Index: ipa.c
> ===================================================================
> --- ipa.c       (revision 215830)
> +++ ipa.c       (working copy)
> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>        if (node->callers && can_replace_by_local_alias (node))
>         {
>           struct cgraph_node *alias = cgraph
> (symtab_nonoverwritable_alias (node));
> +         struct cgraph_edge *e, *next_caller;
>
>           if (alias && alias != node)
>             {
> -             while (node->callers)
> +              for (e = node->callers; e; e = next_caller)
>                 {
> -                 struct cgraph_edge *e = node->callers;
> +                  next_caller = e->next_caller;
> +                 if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
> +                   continue;
>
>                   cgraph_redirect_edge_callee (e, alias);
>                   if (gimple_has_body_p (e->caller->decl))
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
Teresa Johnson Oct. 3, 2014, 4:45 p.m. UTC | #2
On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li <davidxl@google.com> wrote:
> The name 'e' is used for both outer scope edge and inner scope one.

No, the declaration was moved from the inner scope to the outer scope.

Teresa

> This is confusing.
>
> David
>
>
> On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson <tejohnson@google.com> wrote:
>> Adds handling in this block of code (new in gcc/4_9 and therefore
>> google/4_9) for LIPO fake edges for indirect calls, which don't have a
>> call_stmt set and cannot be redirected.
>>
>> Passes regression tests, ok for google/4_9 branch?
>>
>> Teresa
>>
>> 2014-10-03  Teresa Johnson  <tejohnson@google.com>
>>
>>         Google ref b/17378050
>>         * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
>>         call edges.
>>
>> Index: ipa.c
>> ===================================================================
>> --- ipa.c       (revision 215830)
>> +++ ipa.c       (working copy)
>> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>>        if (node->callers && can_replace_by_local_alias (node))
>>         {
>>           struct cgraph_node *alias = cgraph
>> (symtab_nonoverwritable_alias (node));
>> +         struct cgraph_edge *e, *next_caller;
>>
>>           if (alias && alias != node)
>>             {
>> -             while (node->callers)
>> +              for (e = node->callers; e; e = next_caller)
>>                 {
>> -                 struct cgraph_edge *e = node->callers;
>> +                  next_caller = e->next_caller;
>> +                 if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
>> +                   continue;
>>
>>                   cgraph_redirect_edge_callee (e, alias);
>>                   if (gimple_has_body_p (e->caller->decl))
>>
>>
>> --
>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
Xinliang David Li Oct. 3, 2014, 4:48 p.m. UTC | #3
oops -- misread it :)

Ok.

David

On Fri, Oct 3, 2014 at 9:45 AM, Teresa Johnson <tejohnson@google.com> wrote:
> On Fri, Oct 3, 2014 at 9:31 AM, Xinliang David Li <davidxl@google.com> wrote:
>> The name 'e' is used for both outer scope edge and inner scope one.
>
> No, the declaration was moved from the inner scope to the outer scope.
>
> Teresa
>
>> This is confusing.
>>
>> David
>>
>>
>> On Fri, Oct 3, 2014 at 9:27 AM, Teresa Johnson <tejohnson@google.com> wrote:
>>> Adds handling in this block of code (new in gcc/4_9 and therefore
>>> google/4_9) for LIPO fake edges for indirect calls, which don't have a
>>> call_stmt set and cannot be redirected.
>>>
>>> Passes regression tests, ok for google/4_9 branch?
>>>
>>> Teresa
>>>
>>> 2014-10-03  Teresa Johnson  <tejohnson@google.com>
>>>
>>>         Google ref b/17378050
>>>         * ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
>>>         call edges.
>>>
>>> Index: ipa.c
>>> ===================================================================
>>> --- ipa.c       (revision 215830)
>>> +++ ipa.c       (working copy)
>>> @@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
>>>        if (node->callers && can_replace_by_local_alias (node))
>>>         {
>>>           struct cgraph_node *alias = cgraph
>>> (symtab_nonoverwritable_alias (node));
>>> +         struct cgraph_edge *e, *next_caller;
>>>
>>>           if (alias && alias != node)
>>>             {
>>> -             while (node->callers)
>>> +              for (e = node->callers; e; e = next_caller)
>>>                 {
>>> -                 struct cgraph_edge *e = node->callers;
>>> +                  next_caller = e->next_caller;
>>> +                 if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
>>> +                   continue;
>>>
>>>                   cgraph_redirect_edge_callee (e, alias);
>>>                   if (gimple_has_body_p (e->caller->decl))
>>>
>>>
>>> --
>>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
diff mbox

Patch

Index: ipa.c
===================================================================
--- ipa.c       (revision 215830)
+++ ipa.c       (working copy)
@@ -1146,12 +1146,15 @@  function_and_variable_visibility (bool whole_progr
       if (node->callers && can_replace_by_local_alias (node))
        {
          struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+         struct cgraph_edge *e, *next_caller;

          if (alias && alias != node)
            {
-             while (node->callers)
+              for (e = node->callers; e; e = next_caller)
                {
-                 struct cgraph_edge *e = node->callers;
+                  next_caller = e->next_caller;
+                 if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+                   continue;

                  cgraph_redirect_edge_callee (e, alias);