aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-09-04 12:04:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-09-04 12:04:42 +0000
commit5bf734facce9619c0757e32532fe8cc435f27a6d (patch)
tree002b5373060972cc867619c36989735499ce33a1 /gcc/tree-ssa-sccvn.c
parente20d979b7ada10b4665b0c97494ebeb1542ca047 (diff)
downloadgcc-5bf734facce9619c0757e32532fe8cc435f27a6d.zip
gcc-5bf734facce9619c0757e32532fe8cc435f27a6d.tar.gz
gcc-5bf734facce9619c0757e32532fe8cc435f27a6d.tar.bz2
re PR tree-optimization/87211 (gcc ICE at O2: in set_ssa_val_to, at tree-ssa-sccvn.c:3628)
2018-09-04 Richard Biener <rguenther@suse.de> PR tree-optimization/87211 * tree-ssa-sccvn.c (visit_phi): When value-numbering to a backedge value we're supposed to treat as VARYING also number the PHI to VARYING in case it got a different value-number already. * gcc.dg/torture/pr87211.c: New testcase. From-SVN: r264079
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 8d68b6b..1e4bfe5 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4180,7 +4180,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
}
/* If the value we want to use is the backedge and that wasn't visited
- yet drop to VARYING. This only happens when not iterating.
+ yet or if we should take it as VARYING but it has a non-VARYING
+ value drop to VARYING. This only happens when not iterating.
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
@@ -4190,7 +4191,8 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
&& TREE_CODE (backedge_val) == SSA_NAME
&& sameval == backedge_val
&& (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val)
- || !SSA_VISITED (backedge_val)))
+ || !SSA_VISITED (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);