diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-10 10:59:20 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-10 10:59:20 +0000 |
commit | ebca85142eb2e2114f493c151d431fec79f3f85b (patch) | |
tree | f4355ea195f58cfd9e8822fc306980538f7ca6fb /gcc/tree-ssa-sccvn.c | |
parent | 329e71f38e5067bacf1972e3ef5b9116910dda2c (diff) | |
download | gcc-ebca85142eb2e2114f493c151d431fec79f3f85b.tar.gz |
2010-11-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46398
* tree-ssa-sccvn.c (process_scc): Iterate for all PHIs.
* gcc.dg/torture/pr46398.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166527 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 02613aabda1..994e94596cb 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3108,9 +3108,20 @@ process_scc (VEC (tree, heap) *scc) if (VEC_length (tree, scc) == 1) { tree use = VEC_index (tree, scc, 0); - if (!VN_INFO (use)->use_processed) - visit_use (use); - return; + if (VN_INFO (use)->use_processed) + return; + /* We need to make sure it doesn't form a cycle itself, which can + happen for self-referential PHI nodes. In that case we would + end up inserting an expression with VN_TOP operands into the + valid table which makes us derive bogus equivalences later. + The cheapest way to check this is to assume it for all PHI nodes. */ + if (gimple_code (SSA_NAME_DEF_STMT (use)) == GIMPLE_PHI) + /* Fallthru to iteration. */ ; + else + { + visit_use (use); + return; + } } /* Iterate over the SCC with the optimistic table until it stops |