public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
@ 2014-10-15 17:42 Dehao Chen
  2014-10-15 17:51 ` Xinliang David Li
  0 siblings, 1 reply; 4+ messages in thread
From: Dehao Chen @ 2014-10-15 17:42 UTC (permalink / raw)
  To: GCC Patches; +Cc: David Li

This patch recalculates dominance info before update_ssa call in
AutoFDO. This fixes bug when dominance info is out-of-date and causes
segfaults during update_ssa.

Bootstrapped and regression test on-going.

OK for google-4_9 branch?

Thanks,
Dehao

Index: gcc/auto-profile.c
===================================================================
--- gcc/auto-profile.c (revision 216278)
+++ gcc/auto-profile.c (working copy)
@@ -1756,6 +1756,11 @@ auto_profile (void)
       early_inline ();
       autofdo::afdo_annotate_cfg (promoted_stmts);
       compute_function_frequency ();
+
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_DOMINATORS);
       update_ssa (TODO_update_ssa);

       /* Local pure-const may imply need to fixup the cfg.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
  2014-10-15 17:42 [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass Dehao Chen
@ 2014-10-15 17:51 ` Xinliang David Li
  2014-10-15 23:03   ` Dehao Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Xinliang David Li @ 2014-10-15 17:51 UTC (permalink / raw)
  To: Dehao Chen; +Cc: GCC Patches

Is it destroyed by value profile transformations? Can you move the
dominance recomputing code closer to where it gets invalidated?

David

On Wed, Oct 15, 2014 at 10:37 AM, Dehao Chen <dehao@google.com> wrote:
> This patch recalculates dominance info before update_ssa call in
> AutoFDO. This fixes bug when dominance info is out-of-date and causes
> segfaults during update_ssa.
>
> Bootstrapped and regression test on-going.
>
> OK for google-4_9 branch?
>
> Thanks,
> Dehao
>
> Index: gcc/auto-profile.c
> ===================================================================
> --- gcc/auto-profile.c (revision 216278)
> +++ gcc/auto-profile.c (working copy)
> @@ -1756,6 +1756,11 @@ auto_profile (void)
>        early_inline ();
>        autofdo::afdo_annotate_cfg (promoted_stmts);
>        compute_function_frequency ();
> +
> +      free_dominance_info (CDI_DOMINATORS);
> +      free_dominance_info (CDI_POST_DOMINATORS);
> +      calculate_dominance_info (CDI_POST_DOMINATORS);
> +      calculate_dominance_info (CDI_DOMINATORS);
>        update_ssa (TODO_update_ssa);
>
>        /* Local pure-const may imply need to fixup the cfg.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
  2014-10-15 17:51 ` Xinliang David Li
@ 2014-10-15 23:03   ` Dehao Chen
  2014-10-15 23:47     ` Xinliang David Li
  0 siblings, 1 reply; 4+ messages in thread
From: Dehao Chen @ 2014-10-15 23:03 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: GCC Patches

It's destroyed by gimple_value_profile_transformations.

Patch updated to move the update_ssa early.

Index: gcc/auto-profile.c
===================================================================
--- gcc/auto-profile.c (revision 216278)
+++ gcc/auto-profile.c (working copy)
@@ -1674,7 +1674,14 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
       counts_to_freqs ();
     }
   if (flag_value_profile_transformations)
-    gimple_value_profile_transformations ();
+    {
+      gimple_value_profile_transformations ();
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_POST_DOMINATORS);
+      calculate_dominance_info (CDI_DOMINATORS);
+      update_ssa (TODO_update_ssa);
+    }
 }

 /* Wrapper function to invoke early inliner.  */
@@ -1756,7 +1763,6 @@ auto_profile (void)
       early_inline ();
       autofdo::afdo_annotate_cfg (promoted_stmts);
       compute_function_frequency ();
-      update_ssa (TODO_update_ssa);

       /* Local pure-const may imply need to fixup the cfg.  */
       if (execute_fixup_cfg () & TODO_cleanup_cfg)

Dehao

On Wed, Oct 15, 2014 at 10:50 AM, Xinliang David Li <davidxl@google.com> wrote:
> Is it destroyed by value profile transformations? Can you move the
> dominance recomputing code closer to where it gets invalidated?
>
> David
>
> On Wed, Oct 15, 2014 at 10:37 AM, Dehao Chen <dehao@google.com> wrote:
>> This patch recalculates dominance info before update_ssa call in
>> AutoFDO. This fixes bug when dominance info is out-of-date and causes
>> segfaults during update_ssa.
>>
>> Bootstrapped and regression test on-going.
>>
>> OK for google-4_9 branch?
>>
>> Thanks,
>> Dehao
>>
>> Index: gcc/auto-profile.c
>> ===================================================================
>> --- gcc/auto-profile.c (revision 216278)
>> +++ gcc/auto-profile.c (working copy)
>> @@ -1756,6 +1756,11 @@ auto_profile (void)
>>        early_inline ();
>>        autofdo::afdo_annotate_cfg (promoted_stmts);
>>        compute_function_frequency ();
>> +
>> +      free_dominance_info (CDI_DOMINATORS);
>> +      free_dominance_info (CDI_POST_DOMINATORS);
>> +      calculate_dominance_info (CDI_POST_DOMINATORS);
>> +      calculate_dominance_info (CDI_DOMINATORS);
>>        update_ssa (TODO_update_ssa);
>>
>>        /* Local pure-const may imply need to fixup the cfg.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
  2014-10-15 23:03   ` Dehao Chen
@ 2014-10-15 23:47     ` Xinliang David Li
  0 siblings, 0 replies; 4+ messages in thread
From: Xinliang David Li @ 2014-10-15 23:47 UTC (permalink / raw)
  To: Dehao Chen; +Cc: GCC Patches

ok.

David

On Wed, Oct 15, 2014 at 4:00 PM, Dehao Chen <dehao@google.com> wrote:
> It's destroyed by gimple_value_profile_transformations.
>
> Patch updated to move the update_ssa early.
>
> Index: gcc/auto-profile.c
> ===================================================================
> --- gcc/auto-profile.c (revision 216278)
> +++ gcc/auto-profile.c (working copy)
> @@ -1674,7 +1674,14 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
>        counts_to_freqs ();
>      }
>    if (flag_value_profile_transformations)
> -    gimple_value_profile_transformations ();
> +    {
> +      gimple_value_profile_transformations ();
> +      free_dominance_info (CDI_DOMINATORS);
> +      free_dominance_info (CDI_POST_DOMINATORS);
> +      calculate_dominance_info (CDI_POST_DOMINATORS);
> +      calculate_dominance_info (CDI_DOMINATORS);
> +      update_ssa (TODO_update_ssa);
> +    }
>  }
>
>  /* Wrapper function to invoke early inliner.  */
> @@ -1756,7 +1763,6 @@ auto_profile (void)
>        early_inline ();
>        autofdo::afdo_annotate_cfg (promoted_stmts);
>        compute_function_frequency ();
> -      update_ssa (TODO_update_ssa);
>
>        /* Local pure-const may imply need to fixup the cfg.  */
>        if (execute_fixup_cfg () & TODO_cleanup_cfg)
>
> Dehao
>
> On Wed, Oct 15, 2014 at 10:50 AM, Xinliang David Li <davidxl@google.com> wrote:
>> Is it destroyed by value profile transformations? Can you move the
>> dominance recomputing code closer to where it gets invalidated?
>>
>> David
>>
>> On Wed, Oct 15, 2014 at 10:37 AM, Dehao Chen <dehao@google.com> wrote:
>>> This patch recalculates dominance info before update_ssa call in
>>> AutoFDO. This fixes bug when dominance info is out-of-date and causes
>>> segfaults during update_ssa.
>>>
>>> Bootstrapped and regression test on-going.
>>>
>>> OK for google-4_9 branch?
>>>
>>> Thanks,
>>> Dehao
>>>
>>> Index: gcc/auto-profile.c
>>> ===================================================================
>>> --- gcc/auto-profile.c (revision 216278)
>>> +++ gcc/auto-profile.c (working copy)
>>> @@ -1756,6 +1756,11 @@ auto_profile (void)
>>>        early_inline ();
>>>        autofdo::afdo_annotate_cfg (promoted_stmts);
>>>        compute_function_frequency ();
>>> +
>>> +      free_dominance_info (CDI_DOMINATORS);
>>> +      free_dominance_info (CDI_POST_DOMINATORS);
>>> +      calculate_dominance_info (CDI_POST_DOMINATORS);
>>> +      calculate_dominance_info (CDI_DOMINATORS);
>>>        update_ssa (TODO_update_ssa);
>>>
>>>        /* Local pure-const may imply need to fixup the cfg.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-15 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-15 17:42 [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass Dehao Chen
2014-10-15 17:51 ` Xinliang David Li
2014-10-15 23:03   ` Dehao Chen
2014-10-15 23:47     ` Xinliang David Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).