This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
- From: Xinliang David Li <davidxl at google dot com>
- To: Dehao Chen <dehao at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 15 Oct 2014 16:03:55 -0700
- Subject: Re: [GOOGLE] recalculate dominance before update_ssa in AutoFDO pass
- Authentication-results: sourceware.org; auth=none
- References: <CAO2gOZW_XDXKPdhUVApMC+UKk5Cx+QBxw25DHJt2wGtyktZZmw at mail dot gmail dot com> <CAAkRFZLNEKKzO2-Tz=R0QUta7Hqqxir-smGXHX=OwTsxLKQ3Xw at mail dot gmail dot com> <CAO2gOZVffcvf5HitLrfX+cmb4EZWDfEJRcYCFvrSiBhNn_nsgw at mail dot gmail dot com>
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. */