public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH] Handle PHI nodes w/o a argument (PR ipa/80205).
Date: Tue, 28 Mar 2017 08:23:00 -0000	[thread overview]
Message-ID: <CAFiYyc0924oF_6X0FFXdfMZ63h6Cei8hijGMn+XX6Awwk6Lzeg@mail.gmail.com> (raw)
In-Reply-To: <d40534cd-9e13-cb67-8e94-da959c136843@suse.cz>

On Tue, Mar 28, 2017 at 9:45 AM, Martin Liška <mliska@suse.cz> wrote:
> On 03/27/2017 04:27 PM, Richard Biener wrote:
>> On Mon, Mar 27, 2017 at 4:14 PM, Richard Biener
>> <richard.guenther@gmail.com> wrote:
>>> On Mon, Mar 27, 2017 at 2:47 PM, Martin Liška <mliska@suse.cz> wrote:
>>>> Hello.
>>>>
>>>> As described in the PR, we can create a PHI node in einline that has no argument.
>>>> That can cause ICE in devirtualization and should be thus handled.
>>>>
>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>>
>>>> Ready to be installed?
>>>
>>> We shouldn't ever have a PHI w/o argument.
>>
>> ;;   basic block 14, loop depth 0
>> ;;    pred:
>>   # SR.2_19 = PHI <>
>> <L4> [0.00%]:
>>   a::~a (&g);
>>   resx 12
>> ;;    succ:       17
>>
>> the CFG has not been cleaned up here (this block is unreachable).
>>
>> Hmm, I see we are called from fold_stmt.  I suppose we process
>> statements_to_fold before removing unreachable blocks to not
>> walk over dead stmts...  chicken-and-egg...
>>
>> Still not creating that PHI should be possible.
>
> I see, thanks for help. Patch fixes the issue, may I install it after
> regression tested?

I think it's progression, still not 100% safe as we have a SSA name with
a GIMPLE_NOP definition that is not in any BB and the SSA name is not
a default def.

But yes, I've written a comment to that effect ;)

Thus ok.

An improvement would be to not copy unreachable regions at all...

Thanks,
Richard.

> Thanks,
> Martin
>
>>
>> Index: gcc/tree-inline.c
>> ===================================================================
>> --- gcc/tree-inline.c   (revision 246500)
>> +++ gcc/tree-inline.c   (working copy)
>> @@ -2344,6 +2344,13 @@ copy_phis_for_bb (basic_block bb, copy_b
>>        if (!virtual_operand_p (res))
>>         {
>>           walk_tree (&new_res, copy_tree_body_r, id, NULL);
>> +         if (EDGE_COUNT (new_bb->preds) == 0)
>> +           {
>> +             /* Technically we'd want a SSA_DEFAULT_DEF here... */
>> +             SSA_NAME_DEF_STMT (new_res) = gimple_build_nop ();
>> +           }
>> +         else
>> +           {
>>           new_phi = create_phi_node (new_res, new_bb);
>>           FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
>>             {
>> @@ -2389,6 +2396,7 @@ copy_phis_for_bb (basic_block bb, copy_b
>>
>>               add_phi_arg (new_phi, new_arg, new_edge, locus);
>>             }
>> +           }
>>         }
>>      }
>>
>>
>>
>>>> Martin
>

      reply	other threads:[~2017-03-28  8:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 12:51 Martin Liška
2017-03-27 14:25 ` Richard Biener
2017-03-27 14:27   ` Jeff Law
2017-03-27 14:28   ` Richard Biener
2017-03-27 15:30     ` Jeff Law
2017-03-28  7:52     ` Martin Liška
2017-03-28  8:23       ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc0924oF_6X0FFXdfMZ63h6Cei8hijGMn+XX6Awwk6Lzeg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).