aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-08-31 16:50:13 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-08-31 16:50:13 +0000
commitd5481391bc0d71df048476dfb471afb86e9621d9 (patch)
tree5d0e9cb40c42f1eb7a3436fbc49824dd3db44ff5 /gcc/tree-ssa-sccvn.c
parent01540df292a21926c326d8b9478becfe39459fbf (diff)
downloadgcc-d5481391bc0d71df048476dfb471afb86e9621d9.zip
gcc-d5481391bc0d71df048476dfb471afb86e9621d9.tar.gz
gcc-d5481391bc0d71df048476dfb471afb86e9621d9.tar.bz2
re PR tree-optimization/87168 (ICE on valid code at -Os and above on x86_64-linux-gnu: verify_ssa failed)
2018-08-31 Richard Biener <rguenther@suse.de> PR tree-optimization/87168 * tree-ssa-sccvn.c (SSA_VAL): Add visited output parameter. (rpo_elim::eliminate_avail): When OP was not visited it must be available. * gcc.dg/torture/pr87168.c: New testcase. From-SVN: r264021
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 2bf71e5..c333b89 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -456,9 +456,11 @@ VN_INFO (tree name)
/* Return the SSA value of X. */
inline tree
-SSA_VAL (tree x)
+SSA_VAL (tree x, bool *visited = NULL)
{
vn_ssa_aux_t tem = vn_ssa_aux_hash->find_with_hash (x, SSA_NAME_VERSION (x));
+ if (visited)
+ *visited = tem && tem->visited;
return tem && tem->visited ? tem->valnum : x;
}
@@ -5681,7 +5683,12 @@ rpo_elim::~rpo_elim ()
tree
rpo_elim::eliminate_avail (basic_block bb, tree op)
{
- tree valnum = SSA_VAL (op);
+ bool visited;
+ tree valnum = SSA_VAL (op, &visited);
+ /* If we didn't visit OP then it must be defined outside of the
+ region we process and also dominate it. So it is available. */
+ if (!visited)
+ return op;
if (TREE_CODE (valnum) == SSA_NAME)
{
if (SSA_NAME_IS_DEFAULT_DEF (valnum))