aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-09-08 16:31:43 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-09-08 16:31:43 +0000
commit7220ca2b3822219e56497f4d18ceb043656acb71 (patch)
treeaee1d6b6b943eaad16bcc7f6620c5cb7275d2694 /gcc/tree-ssa-sccvn.c
parent94c8a0cca5ddcf29d1185699900882522c6a51b1 (diff)
downloadgcc-7220ca2b3822219e56497f4d18ceb043656acb71.zip
gcc-7220ca2b3822219e56497f4d18ceb043656acb71.tar.gz
gcc-7220ca2b3822219e56497f4d18ceb043656acb71.tar.bz2
re PR tree-optimization/37421 (ICE in vn_reference_insert_pieces at tree-ssa-sccvn.c:1131)
2008-09-08 Richard Guenther <rguenther@suse.de> PR tree-optimization/37421 * tree-ssa-sccvn.c (visit_copy): Make sure to fully valueize the RHS. * g++.dg/torture/pr37421.C: New testcase. From-SVN: r140111
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 0b995d6..09b2ee8 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1607,13 +1607,17 @@ static bool
visit_copy (tree lhs, tree rhs)
{
/* Follow chains of copies to their destination. */
- while (SSA_VAL (rhs) != rhs && TREE_CODE (SSA_VAL (rhs)) == SSA_NAME)
+ while (TREE_CODE (rhs) == SSA_NAME
+ && SSA_VAL (rhs) != rhs)
rhs = SSA_VAL (rhs);
/* The copy may have a more interesting constant filled expression
(we don't, since we know our RHS is just an SSA name). */
- VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants;
- VN_INFO (lhs)->expr = VN_INFO (rhs)->expr;
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants;
+ VN_INFO (lhs)->expr = VN_INFO (rhs)->expr;
+ }
return set_ssa_val_to (lhs, rhs);
}