aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-09-25 12:51:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-09-25 12:51:57 +0000
commita0d013bdc22353a1b835c5f009259ae032a6b84b (patch)
treeb154d7d697ee8d70b7b640b709975ef67447d3c7
parent5d6749d1f241223353cba6cb637738bb5b698756 (diff)
downloadgcc-a0d013bdc22353a1b835c5f009259ae032a6b84b.zip
gcc-a0d013bdc22353a1b835c5f009259ae032a6b84b.tar.gz
gcc-a0d013bdc22353a1b835c5f009259ae032a6b84b.tar.bz2
re PR tree-optimization/87402 (ICE in set_ssa_val_to, at tree-ssa-sccvn.c:3645)
2018-09-25 Richard Biener <rguenther@suse.de> PR tree-optimization/87402 * tree-ssa-sccvn.c (SSA_VISITED): Remove unused function. (visit_phi): Re-instantiate handling of supposed to be VARYING but non-VARYING backedge value. * gcc.dg/torture/pr87402.c: New testcase. From-SVN: r264566
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr87402.c33
-rw-r--r--gcc/tree-ssa-sccvn.c17
4 files changed, 51 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 61422ad..b81172f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2018-09-25 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/87402
+ * tree-ssa-sccvn.c (SSA_VISITED): Remove unused function.
+ (visit_phi): Re-instantiate handling of supposed to be VARYING
+ but non-VARYING backedge value.
+
+2018-09-25 Richard Biener <rguenther@suse.de>
+
PR debug/83941
* dwarf2out.c (struct sym_off_pair): New.
(external_die_map): New global.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index af269f4..76a8a86 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87402
+ * gcc.dg/torture/pr87402.c: New testcase.
+
2018-09-25 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/70150
diff --git a/gcc/testsuite/gcc.dg/torture/pr87402.c b/gcc/testsuite/gcc.dg/torture/pr87402.c
new file mode 100644
index 0000000..a27ac4f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr87402.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+
+void
+xl (int co)
+{
+ int ar = 0;
+
+ if (ar != 0)
+ {
+ int pp, ll = 0;
+ int *zx;
+
+ if (co == 0)
+ {
+ }
+ else
+ {
+ zx = &pp;
+
+ if (co < 0)
+ while (co < 1)
+ {
+to:
+ while (ll < 1)
+ ++ll;
+ }
+
+ *zx = (__INTPTR_TYPE__)&ar;
+ }
+ }
+
+ goto to;
+}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index cee3d73..5a05dfb 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -464,15 +464,6 @@ SSA_VAL (tree x, bool *visited = NULL)
return tem && tem->visited ? tem->valnum : x;
}
-/* Return whether X was visited. */
-
-inline bool
-SSA_VISITED (tree x)
-{
- vn_ssa_aux_t tem = vn_ssa_aux_hash->find_with_hash (x, SSA_NAME_VERSION (x));
- return tem && tem->visited;
-}
-
/* Return the SSA value of the VUSE x, supporting released VDEFs
during elimination which will value-number the VDEF to the
associated VUSE (but not substitute in the whole lattice). */
@@ -4196,7 +4187,10 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
}
}
- /* If we value-number a virtual operand never value-number to the
+ /* If the value we want to use is flowing over the backedge and we
+ should take it as VARYING but it has a non-VARYING value drop to
+ VARYING.
+ If we value-number a virtual operand never value-number to the
value from the backedge as that confuses the alias-walking code.
See gcc.dg/torture/pr87176.c. If the value is the same on a
non-backedge everything is OK though. */
@@ -4204,7 +4198,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
&& !seen_non_backedge
&& TREE_CODE (backedge_val) == SSA_NAME
&& sameval == backedge_val
- && SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val))
+ && (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val)
+ || SSA_VAL (backedge_val) != backedge_val))
/* Note this just drops to VARYING without inserting the PHI into
the hashes. */
result = PHI_RESULT (phi);