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: Mon, 27 Mar 2017 14:28:00 -0000 [thread overview]
Message-ID: <CAFiYyc1wRxXfDjtKa97wtgTdPUQF9B1v3EWoLQWAAFOBFWfwCA@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc1+t3rnzsRVUR6TbB-MQZBpo-Rr2D7c0VHE3EE8Hcinew@mail.gmail.com>
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.
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
next prev parent reply other threads:[~2017-03-27 14:27 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 [this message]
2017-03-27 15:30 ` Jeff Law
2017-03-28 7:52 ` Martin Liška
2017-03-28 8:23 ` Richard Biener
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=CAFiYyc1wRxXfDjtKa97wtgTdPUQF9B1v3EWoLQWAAFOBFWfwCA@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).