public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch/committed] PR middle-end/65233 make walk-ssa_copies handle empty PHIs
@ 2015-03-02  5:34 Aldy Hernandez
  2015-03-02  8:38 ` Richard Biener
  0 siblings, 1 reply; 10+ messages in thread
From: Aldy Hernandez @ 2015-03-02  5:34 UTC (permalink / raw)
  To: gcc-patches, Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

As I mention in the PR...

What's happening here is that the ipa_polymorphic_call_context 
constructor is calling walk_ssa_copies on a PHI node that has no 
arguments.  This happens because finalize_jump_threads eventually 
removes some PHI arguments as it's redirecting some edges, leaving a PHI 
with no arguments:

SR.33_23 = PHI <>

This should get cleaned up later, but the IPA polymorphic code gets 
called during the actual CFG clean-up, and walk_ssa_copies cannot handle 
an empty PHI.

Approved by Honza.

Fully tested on x86-64 Linux and verified that the patch fixes the ICE 
on an x86-64 Linux cross aarch64-linux-gnu cc1plus.

Committed to mainline.

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 846 bytes --]

commit cdb5a8f26178f61d6a2fdb2543f6c8b4c7136c94
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Sun Mar 1 21:21:37 2015 -0800

    	PR middle-end/65233
    	* ipa-polymorphic-call.c (walk_ssa_copies): Handle empty PHIs.

diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index aaa549e..13cc7f6 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -835,7 +835,10 @@ walk_ssa_copies (tree op, hash_set<tree> **global_visited = NULL)
 	{
 	  gimple phi = SSA_NAME_DEF_STMT (op);
 
-	  if (gimple_phi_num_args (phi) > 2)
+	  if (gimple_phi_num_args (phi) > 2
+	      /* We can be called while cleaning up the CFG and can
+		 have empty PHIs about to be removed.  */
+	      || gimple_phi_num_args (phi) == 0)
 	    goto done;
 	  if (gimple_phi_num_args (phi) == 1)
 	    op = gimple_phi_arg_def (phi, 0);

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-05 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02  5:34 [patch/committed] PR middle-end/65233 make walk-ssa_copies handle empty PHIs Aldy Hernandez
2015-03-02  8:38 ` Richard Biener
2015-03-03 20:18   ` Jan Hubicka
2015-03-04  5:27   ` Jeff Law
2015-03-04 12:41     ` Richard Biener
2015-03-04 13:30       ` Richard Biener
2015-03-04 21:22         ` Jan Hubicka
2015-03-05  0:54         ` Jan Hubicka
2015-03-05  8:47           ` Richard Biener
2015-03-05 16:10             ` Jeff Law

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