Fix ICE with -fauto-profile when walking vdefs
Richard Biener
rguenther@suse.de
Mon Apr 3 10:34:00 GMT 2017
On Fri, 31 Mar 2017, Sebastian Pop wrote:
> On Fri, Mar 31, 2017 at 12:06 PM, Richard Biener <rguenther@suse.de> wrote:
> > That's not a default definition but bogus SSA form. You have to fix that, not this symptom.
> >
>
> Ok.
> It also crashes when adding a call to verifty_ssa
>
> diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
> index 4b21340c6f0..b834a40af4d 100644
> --- a/gcc/auto-profile.c
> +++ b/gcc/auto-profile.c
> @@ -1589,6 +1590,7 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
> static void
> early_inline ()
> {
> + verify_ssa (true, true);
> compute_inline_parameters (cgraph_node::get (current_function_decl), true);
> unsigned todo = early_inliner (cfun);
> if (todo & TODO_update_ssa_any)
>
> The crash is on:
>
> gcc_assert (!need_ssa_update_p (cfun));
>
> and after adding a call to update the SSA, it finishes compilation
> without errors.
> I am testing the following patch:
>
> * auto-profile.c (early_inline): Call update_ssa.
>
> --- a/gcc/auto-profile.c
> +++ b/gcc/auto-profile.c
> @@ -1589,6 +1589,8 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
> static void
> early_inline ()
> {
> + if (need_ssa_update_p (current_function_decl))
> + update_ssa (TODO_update_ssa);
> compute_inline_parameters (cgraph_node::get (current_function_decl), true);
> unsigned todo = early_inliner (cfun);
> if (todo & TODO_update_ssa_any)
Does the following fix it?
Index: gcc/auto-profile.c
===================================================================
--- gcc/auto-profile.c (revision 246642)
+++ gcc/auto-profile.c (working copy)
@@ -1511,7 +1511,9 @@ afdo_vpt_for_early_inline (stmt_set *pro
if (has_vpt)
{
- optimize_inline_calls (current_function_decl);
+ unsigned todo = optimize_inline_calls (current_function_decl);
+ if (todo & TODO_update_ssa_any)
+ update_ssa (TODO_update_ssa);
return true;
}
afdo really _grossly_ over-does inlining. And it looks like a total
hack to me.
It iterates PARAM_EARLY_INLINER_MAX_ITERATIONS but early_inliner does
that itself already..
More information about the Gcc-patches
mailing list