diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-08 16:31:43 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-08 16:31:43 +0000 |
commit | 0cce97a638ada18d399567b3f500827d9ae19d0e (patch) | |
tree | aee1d6b6b943eaad16bcc7f6620c5cb7275d2694 /gcc/tree-ssa-sccvn.c | |
parent | 1a51554b2fb99c743d635cee3bdcb36e1fe12c9f (diff) | |
download | gcc-0cce97a638ada18d399567b3f500827d9ae19d0e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140111 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 0b995d6837d..09b2ee8fffd 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); } |