diff options
author | Richard Guenther <rguenther@suse.de> | 2009-04-20 14:01:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-04-20 14:01:52 +0000 |
commit | 438c239d7629e2107dd831760835895c82f7d8f3 (patch) | |
tree | 1f17a313bc30e85d418e64815f036e5b5545b849 /gcc/tree-ssa-phiprop.c | |
parent | e69614ada0f86b7583c6d834e02f2835b2b58bb1 (diff) | |
download | gcc-438c239d7629e2107dd831760835895c82f7d8f3.zip gcc-438c239d7629e2107dd831760835895c82f7d8f3.tar.gz gcc-438c239d7629e2107dd831760835895c82f7d8f3.tar.bz2 |
basic-block.h (get_all_dominated_blocks): Declare.
2009-04-20 Richard Guenther <rguenther@suse.de>
* basic-block.h (get_all_dominated_blocks): Declare.
* dominance.c (get_all_dominated_blocks): New function.
* tree-cfg.c (get_all_dominated_blocks): Remove.
(remove_edge_and_dominated_blocks): Adjust.
* tree-ssa-phiprop.c (tree_ssa_phiprop_1): Fold in ...
(tree_ssa_phiprop): ... here. Use get_all_dominated_blocks
instead of recursing.
From-SVN: r146425
Diffstat (limited to 'gcc/tree-ssa-phiprop.c')
-rw-r--r-- | gcc/tree-ssa-phiprop.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index d95b358..f608f1d 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -325,41 +325,34 @@ next:; return phi_inserted; } -/* Helper walking the dominator tree starting from BB and processing - phi nodes with global data PHIVN and N. */ - -static bool -tree_ssa_phiprop_1 (basic_block bb, struct phiprop_d *phivn, size_t n) -{ - bool did_something = false; - basic_block son; - gimple_stmt_iterator gsi; - - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n); - - for (son = first_dom_son (CDI_DOMINATORS, bb); - son; - son = next_dom_son (CDI_DOMINATORS, son)) - did_something |= tree_ssa_phiprop_1 (son, phivn, n); - - return did_something; -} - /* Main entry for phiprop pass. */ static unsigned int tree_ssa_phiprop (void) { + VEC(basic_block, heap) *bbs; struct phiprop_d *phivn; + bool did_something = false; + basic_block bb; + gimple_stmt_iterator gsi; + unsigned i; calculate_dominance_info (CDI_DOMINATORS); phivn = XCNEWVEC (struct phiprop_d, num_ssa_names); - if (tree_ssa_phiprop_1 (ENTRY_BLOCK_PTR, phivn, num_ssa_names)) + /* Walk the dominator tree in preorder. */ + bbs = get_all_dominated_blocks (CDI_DOMINATORS, + single_succ (ENTRY_BLOCK_PTR)); + for (i = 0; VEC_iterate (basic_block, bbs, i, bb); ++i) + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + did_something |= propagate_with_phi (bb, gsi_stmt (gsi), + phivn, num_ssa_names); + + if (did_something) gsi_commit_edge_inserts (); + VEC_free (basic_block, heap, bbs); free (phivn); return 0; |