* [PATCH][GIMPLE FE] Handle non-SSA PHI args
@ 2016-10-27 12:20 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-10-27 12:20 UTC (permalink / raw)
To: gcc-patches
Tested on x86_64-unknown-linux-gnu.
Richard.
2016-10-27 Richard Biener <rguenther@suse.de>
* tree-into-ssa.c (rewrite_add_phi_arguments): Handle non-SSA
PHI arguments from the GIMPLE FE.
* gcc.dg/gimplefe-18.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/gimplefe-18.c b/gcc/testsuite/gcc.dg/gimplefe-18.c
new file mode 100644
index 0000000..ba918b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-18.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+int
+__GIMPLE () *
+foo ()
+{
+ int _1;
+ int j;
+ int *b;
+ _1 = 1;
+bb1:
+ if (_1)
+ goto bb3;
+ else
+ goto bb2;
+
+bb2:
+ b_2 = (int *)0;
+
+bb3:
+ b_4 = __PHI (bb1: &j, bb2: b_2);
+ return b_4;
+}
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 7eaf8ae..0e78845 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1383,10 +1383,11 @@ rewrite_add_phi_arguments (basic_block bb)
phi = gsi.phi ();
res = gimple_phi_result (phi);
- /* If we have pre-existing PHI its args may be different
- vars than existing vars */
+ /* If we have pre-existing PHI (via the GIMPLE FE) its args may
+ be different vars than existing vars and they may be constants
+ as well. Note the following supports partial SSA for PHI args. */
argvar = gimple_phi_arg_def (phi, e->dest_idx);
- if (argvar && TREE_CODE (argvar) == SSA_NAME)
+ if (argvar && ! DECL_P (argvar))
continue;
if (!argvar)
argvar = SSA_NAME_VAR (res);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-27 12:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 12:20 [PATCH][GIMPLE FE] Handle non-SSA PHI args Richard Biener
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).