diff mbox

[GOOGLE] Remove zero_edge propagation algorithm

Message ID CAO2gOZXAey_NDZYqPPwZUxbd=wz6j6nYt2susoXCoY=J9m7DHw@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen Nov. 22, 2013, 9:59 p.m. UTC
Patch updated...

There is no performance change with/without the patch. I think this
was used to workaround the debug info accuracy issue. But after debug
info is more improved now, the heuristic is not needed any more.

Thanks,
Dehao


On Fri, Nov 22, 2013 at 1:17 PM, Xinliang David Li <davidxl@google.com> wrote:
> On Fri, Nov 22, 2013 at 12:27 PM, Dehao Chen <dehao@google.com> wrote:
>> This patch removes the zero_edge heuristic during profile propagation.
>> The zero_edge heuristic does not seem to be effective in improving
>> performance.
>
> "not effective" here means degrading performance?
>
> David
>
>>
>> Tested:
>> Bootstrapped and passed regression test and performance test.
>>
>> OK for google-4_8?
>>
>> Thanks,
>> Dehao
>>
>> Index: gcc/auto-profile.c
>> ===================================================================
>> --- gcc/auto-profile.c (revision 205232)
>> +++ gcc/auto-profile.c (working copy)
>> @@ -1122,7 +1122,7 @@ afdo_propagate_multi_edge (bool is_succ)
>>
>>    FOR_EACH_BB (bb)
>>      {
>> -      edge e, unknown_edge = NULL, zero_edge = NULL;
>> +      edge e, unknown_edge = NULL;
>>        edge_iterator ei;
>>        int num_unknown_edge = 0;
>>        gcov_type total_known_count = 0;
>> @@ -1132,8 +1132,6 @@ afdo_propagate_multi_edge (bool is_succ)
>>    FOR_EACH_EDGE (e, ei, bb->succs)
>>      if ((e->flags & EDGE_ANNOTATED) == 0)
>>        num_unknown_edge ++, unknown_edge = e;
>> -    else if (e->count == 0)
>> -      zero_edge = e;
>>      else
>>        total_known_count += e->count;
>>   }
>> @@ -1153,12 +1151,6 @@ afdo_propagate_multi_edge (bool is_succ)
>>        bb->count = total_known_count;
>>        changed = true;
>>      }
>> -  else if (zero_edge != NULL && total_known_count < bb->count
>> -   && bb->loop_father && bb->loop_father->header == bb)
>> -    {
>> -      zero_edge->count = bb->count - total_known_count;
>> -      changed = true;
>> -    }
>>    if ((bb->flags & BB_ANNOTATED) == 0)
>>      {
>>        bb->flags |= BB_ANNOTATED;

Comments

Xinliang David Li Nov. 22, 2013, 10:38 p.m. UTC | #1
ok thanks.

David

On Fri, Nov 22, 2013 at 1:59 PM, Dehao Chen <dehao@google.com> wrote:
> Patch updated...
>
> There is no performance change with/without the patch. I think this
> was used to workaround the debug info accuracy issue. But after debug
> info is more improved now, the heuristic is not needed any more.
>
> Thanks,
> Dehao
>
> Index: gcc/auto-profile.c
> ===================================================================
> --- gcc/auto-profile.c (revision 205232)
> +++ gcc/auto-profile.c (working copy)
> @@ -1122,29 +1122,16 @@ afdo_propagate_multi_edge (bool is_succ)
>
>    FOR_EACH_BB (bb)
>      {
> -      edge e, unknown_edge = NULL, zero_edge = NULL;
> +      edge e, unknown_edge = NULL;
>        edge_iterator ei;
>        int num_unknown_edge = 0;
>        gcov_type total_known_count = 0;
>
> -      if (is_succ)
> - {
> -  FOR_EACH_EDGE (e, ei, bb->succs)
> -    if ((e->flags & EDGE_ANNOTATED) == 0)
> -      num_unknown_edge ++, unknown_edge = e;
> -    else if (e->count == 0)
> -      zero_edge = e;
> -    else
> -      total_known_count += e->count;
> - }
> -      else
> - {
> -  FOR_EACH_EDGE (e, ei, bb->preds)
> -    if ((e->flags & EDGE_ANNOTATED) == 0)
> -      num_unknown_edge ++, unknown_edge = e;
> -    else
> -      total_known_count += e->count;
> - }
> +      FOR_EACH_EDGE (e, ei, is_succ ? bb->succs : bb->preds)
> + if ((e->flags & EDGE_ANNOTATED) == 0)
> +  num_unknown_edge ++, unknown_edge = e;
> + else
> +  total_known_count += e->count;
>
>        if (num_unknown_edge == 0)
>   {
> @@ -1153,12 +1140,6 @@ afdo_propagate_multi_edge (bool is_succ)
>        bb->count = total_known_count;
>        changed = true;
>      }
> -  else if (zero_edge != NULL && total_known_count < bb->count
> -   && bb->loop_father && bb->loop_father->header == bb)
> -    {
> -      zero_edge->count = bb->count - total_known_count;
> -      changed = true;
> -    }
>    if ((bb->flags & BB_ANNOTATED) == 0)
>      {
>        bb->flags |= BB_ANNOTATED;
>
> On Fri, Nov 22, 2013 at 1:17 PM, Xinliang David Li <davidxl@google.com> wrote:
>> On Fri, Nov 22, 2013 at 12:27 PM, Dehao Chen <dehao@google.com> wrote:
>>> This patch removes the zero_edge heuristic during profile propagation.
>>> The zero_edge heuristic does not seem to be effective in improving
>>> performance.
>>
>> "not effective" here means degrading performance?
>>
>> David
>>
>>>
>>> Tested:
>>> Bootstrapped and passed regression test and performance test.
>>>
>>> OK for google-4_8?
>>>
>>> Thanks,
>>> Dehao
>>>
>>> Index: gcc/auto-profile.c
>>> ===================================================================
>>> --- gcc/auto-profile.c (revision 205232)
>>> +++ gcc/auto-profile.c (working copy)
>>> @@ -1122,7 +1122,7 @@ afdo_propagate_multi_edge (bool is_succ)
>>>
>>>    FOR_EACH_BB (bb)
>>>      {
>>> -      edge e, unknown_edge = NULL, zero_edge = NULL;
>>> +      edge e, unknown_edge = NULL;
>>>        edge_iterator ei;
>>>        int num_unknown_edge = 0;
>>>        gcov_type total_known_count = 0;
>>> @@ -1132,8 +1132,6 @@ afdo_propagate_multi_edge (bool is_succ)
>>>    FOR_EACH_EDGE (e, ei, bb->succs)
>>>      if ((e->flags & EDGE_ANNOTATED) == 0)
>>>        num_unknown_edge ++, unknown_edge = e;
>>> -    else if (e->count == 0)
>>> -      zero_edge = e;
>>>      else
>>>        total_known_count += e->count;
>>>   }
>>> @@ -1153,12 +1151,6 @@ afdo_propagate_multi_edge (bool is_succ)
>>>        bb->count = total_known_count;
>>>        changed = true;
>>>      }
>>> -  else if (zero_edge != NULL && total_known_count < bb->count
>>> -   && bb->loop_father && bb->loop_father->header == bb)
>>> -    {
>>> -      zero_edge->count = bb->count - total_known_count;
>>> -      changed = true;
>>> -    }
>>>    if ((bb->flags & BB_ANNOTATED) == 0)
>>>      {
>>>        bb->flags |= BB_ANNOTATED;
diff mbox

Patch

Index: gcc/auto-profile.c
===================================================================
--- gcc/auto-profile.c (revision 205232)
+++ gcc/auto-profile.c (working copy)
@@ -1122,29 +1122,16 @@  afdo_propagate_multi_edge (bool is_succ)

   FOR_EACH_BB (bb)
     {
-      edge e, unknown_edge = NULL, zero_edge = NULL;
+      edge e, unknown_edge = NULL;
       edge_iterator ei;
       int num_unknown_edge = 0;
       gcov_type total_known_count = 0;

-      if (is_succ)
- {
-  FOR_EACH_EDGE (e, ei, bb->succs)
-    if ((e->flags & EDGE_ANNOTATED) == 0)
-      num_unknown_edge ++, unknown_edge = e;
-    else if (e->count == 0)
-      zero_edge = e;
-    else
-      total_known_count += e->count;
- }
-      else
- {
-  FOR_EACH_EDGE (e, ei, bb->preds)
-    if ((e->flags & EDGE_ANNOTATED) == 0)
-      num_unknown_edge ++, unknown_edge = e;
-    else
-      total_known_count += e->count;
- }
+      FOR_EACH_EDGE (e, ei, is_succ ? bb->succs : bb->preds)
+ if ((e->flags & EDGE_ANNOTATED) == 0)
+  num_unknown_edge ++, unknown_edge = e;
+ else
+  total_known_count += e->count;

       if (num_unknown_edge == 0)
  {
@@ -1153,12 +1140,6 @@  afdo_propagate_multi_edge (bool is_succ)
       bb->count = total_known_count;
       changed = true;
     }
-  else if (zero_edge != NULL && total_known_count < bb->count
-   && bb->loop_father && bb->loop_father->header == bb)
-    {
-      zero_edge->count = bb->count - total_known_count;
-      changed = true;
-    }
   if ((bb->flags & BB_ANNOTATED) == 0)
     {
       bb->flags |= BB_ANNOTATED;