summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 14:01:52 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-20 14:01:52 +0000
commit59f3ea59d3c5c480e0ea7958da7a4ef6e317b91f (patch)
tree1f17a313bc30e85d418e64815f036e5b5545b849 /gcc/tree-ssa-phiprop.c
parentd2bf053d7a80f067d92121a8e72d935785fc76b8 (diff)
downloadgcc-59f3ea59d3c5c480e0ea7958da7a4ef6e317b91f.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146425 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-phiprop.c')
-rw-r--r--gcc/tree-ssa-phiprop.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index d95b3584b91..f608f1d056e 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;