diff mbox

Fix ICE with -fauto-profile when walking vdefs

Message ID CAFk3UF-t=_yU8J_xH3K86MMavmUj_YsEbGy0=aFg9-PRYW3Rvg@mail.gmail.com
State New
Headers show

Commit Message

Sebastian Pop March 31, 2017, 6:10 p.m. UTC
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

Comments

Richard Biener March 31, 2017, 6:50 p.m. UTC | #1
On March 31, 2017 8:10:51 PM GMT+02:00, Sebastian Pop <sebpop@gmail.com> 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:

That looks like a workaround rather than the correct fix.  Who sets .MEM? It should assign the proper def.

OTOH I don't know why there's any inlining code in auto-profile.

Richard.

>        * 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)
diff mbox

Patch

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)