Fix ICE with -fauto-profile when walking vdefs

Submitted by Martin Liška on April 19, 2017, 10:55 a.m.

Details

Message ID 6c966edc-2dfa-0302-a68f-742724692e79@suse.cz
State New
Headers show

Commit Message

Martin Liška April 19, 2017, 10:55 a.m.
On 04/18/2017 08:05 PM, Sebastian Pop wrote:
> On Mon, Apr 3, 2017 at 5:34 AM, Richard Biener <rguenther@suse.de> wrote:
>> On Fri, 31 Mar 2017, Sebastian Pop wrote:
>>
>>> On Fri, Mar 31, 2017 at 12:06 PM, Richard Biener <rguenther@suse.de> wrote:
>> 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;
>>      }
>
> Yes, this patch solves the problem, and this is also what Dehao has
> suggested in his last comment in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65972
>
> Thanks,
> Sebastian

Hi.

I've just tested the patch and survives bootstrap.
May I install the patch?

Martin

>
>>
>>
>> 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..

Comments

Richard Guenther April 19, 2017, 12:03 p.m.
On April 19, 2017 12:55:24 PM GMT+02:00, "Martin Liška" <mliska@suse.cz> wrote:
>On 04/18/2017 08:05 PM, Sebastian Pop wrote:
>> On Mon, Apr 3, 2017 at 5:34 AM, Richard Biener <rguenther@suse.de>
>wrote:
>>> On Fri, 31 Mar 2017, Sebastian Pop wrote:
>>>
>>>> On Fri, Mar 31, 2017 at 12:06 PM, Richard Biener
><rguenther@suse.de> wrote:
>>> 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;
>>>      }
>>
>> Yes, this patch solves the problem, and this is also what Dehao has
>> suggested in his last comment in
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65972
>>
>> Thanks,
>> Sebastian
>
>Hi.
>
>I've just tested the patch and survives bootstrap.
>May I install the patch?


Yes.

Richard.
>Martin
>
>>
>>>
>>>
>>> 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..

Patch hide | download patch | download mbox

From b778a13b31b4237e147ab4d0dbc7651dda000def Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 19 Apr 2017 10:00:35 +0200
Subject: [PATCH] Update SSA after AutoPGO early inlining (PR ipa/65972).

gcc/ChangeLog:

2017-04-19  Richard Biener  <rguenther@suse.de>

	PR ipa/65972
	* auto-profile.c (afdo_vpt_for_early_inline): Update SSA
	when needed by AutoPGO.
---
 gcc/auto-profile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index 4b21340c6f0..4e498dc6b0e 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -1511,7 +1511,9 @@  afdo_vpt_for_early_inline (stmt_set *promoted_stmts)
 
   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;
     }
 
-- 
2.12.2