aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-15 14:10:10 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-15 14:10:10 +0000
commit4f912f91a095e78dc69ff875de4aeb41188c0655 (patch)
tree9289336911f82646a605073e7d3d0ba579f084ae
parent20adfc6c1cdc9ab49f9c930e52c1bb1ca4e2f433 (diff)
downloadgcc-4f912f91a095e78dc69ff875de4aeb41188c0655.zip
gcc-4f912f91a095e78dc69ff875de4aeb41188c0655.tar.gz
gcc-4f912f91a095e78dc69ff875de4aeb41188c0655.tar.bz2
re PR tree-optimization/67470 (ICE at -O3 on x86_64-linux-gnu in compute_live_loop_exits, at tree-ssa-loop-manip.c:235)
2015-09-15 Richard Biener <rguenther@suse.de> PR tree-optimization/67470 * tree-ssa-loop-im.c (execute_sm_if_changed): Preserve PHI structure for PHI hoisting by inserting a forwarder block if appropriate. * gcc.dg/torture/pr67470.c: New testcase. From-SVN: r227797
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr67470.c30
-rw-r--r--gcc/tree-ssa-loop-im.c17
4 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fda0151..bc00735 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/67470
+ * tree-ssa-loop-im.c (execute_sm_if_changed): Preserve PHI
+ structure for PHI hoisting by inserting a forwarder block
+ if appropriate.
+
2015-09-15 Christian Bruel <christian.bruel@st.com>
* config/arm/arm.c (TARGET_OPTION_PRINT): Define.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6cea108..c8aa20a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/67470
+ * gcc.dg/torture/pr67470.c: New testcase.
+
2015-09-15 Alan Lawrence <alan.lawrence@arm.com>
* gcc.target/aarch64/vect_int32x2x4_1.c: New.
diff --git a/gcc/testsuite/gcc.dg/torture/pr67470.c b/gcc/testsuite/gcc.dg/torture/pr67470.c
new file mode 100644
index 0000000..29a23c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr67470.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+
+int a, b, *c, d, e;
+
+void abort (void);
+
+int
+main ()
+{
+ int f, *g, **h = &g;
+ for (; b;)
+ {
+ c = &a;
+ for (e = 0; e < 1; e++)
+ *h = 0;
+ for (; d; d++)
+ if (f)
+ *c = 0;
+ else
+ {
+ *c = e = 0;
+ *h = &a;
+ }
+
+ if (a && !g)
+ abort ();
+
+ }
+ return 0;
+}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index f1d4a8c..f67b57d 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1839,6 +1839,23 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
if (loop_has_only_one_exit)
ex = split_block_after_labels (ex->dest);
+ else
+ {
+ for (gphi_iterator gpi = gsi_start_phis (ex->dest);
+ !gsi_end_p (gpi); gsi_next (&gpi))
+ {
+ gphi *phi = gpi.phi ();
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ continue;
+
+ /* When the destination has a non-virtual PHI node with multiple
+ predecessors make sure we preserve the PHI structure by
+ forcing a forwarder block so that hoisting of that PHI will
+ still work. */
+ split_edge (ex);
+ break;
+ }
+ }
old_dest = ex->dest;
new_bb = split_edge (ex);