diff options
author | Richard Guenther <rguenther@suse.de> | 2011-03-15 11:09:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-03-15 11:09:09 +0000 |
commit | e106efc7801f8607c3453673a8c261cb59c3afb0 (patch) | |
tree | 676bfe35c1401333a3e6069eaf9dfdb1c6b71af8 /gcc/tree-ssa-phiopt.c | |
parent | 17dea42fc45256b06cb19bc36b18e77fdc0f20a6 (diff) | |
download | gcc-e106efc7801f8607c3453673a8c261cb59c3afb0.zip gcc-e106efc7801f8607c3453673a8c261cb59c3afb0.tar.gz gcc-e106efc7801f8607c3453673a8c261cb59c3afb0.tar.bz2 |
re PR tree-optimization/41490 (tree-ssa-sink does not really work)
2011-03-15 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41490
* tree-ssa-dce.c (propagate_necessity): Handle returns without
value but with VUSE.
* tree-ssa-operands.c (parse_ssa_operands): Add a VUSE on all
return statements.
* tree-ssa-sink.c (statement_sink_location): Fix store sinking.
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Handle virtual PHIs.
* tree-tailcall.c (find_tail_calls): Ignore returns.
* gcc.dg/tree-ssa/ssa-sink-6.c: New testcase.
* gcc.dg/tree-ssa/ssa-sink-7.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-8.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-9.c: Likewise.
* g++.dg/tree-ssa/pr33604.C: Adjust.
From-SVN: r170984
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index d197bdd..e5ff683 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -311,14 +311,26 @@ tree_ssa_phiopt_worker (bool do_store_elim) else { gimple_seq phis = phi_nodes (bb2); + gimple_stmt_iterator gsi; - /* Check to make sure that there is only one PHI node. + /* Check to make sure that there is only one non-virtual PHI node. TODO: we could do it with more than one iff the other PHI nodes have the same elements for these two edges. */ - if (! gimple_seq_singleton_p (phis)) + phi = NULL; + for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi)) + { + if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi)))) + continue; + if (phi) + { + phi = NULL; + break; + } + phi = gsi_stmt (gsi); + } + if (!phi) continue; - phi = gsi_stmt (gsi_start (phis)); arg0 = gimple_phi_arg_def (phi, e1->dest_idx); arg1 = gimple_phi_arg_def (phi, e2->dest_idx); |