diff options
author | Maxim Kuvyrkov <maxim@codesourcery.com> | 2010-07-27 19:48:15 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <mkuvyrkov@gcc.gnu.org> | 2010-07-27 19:48:15 +0000 |
commit | cad9aa150ba3ff8c1dc34bf428fc7146dce463b0 (patch) | |
tree | ef6e287dda7baf7be12f1fb62bf64d66c6a8211d /gcc/dominance.c | |
parent | 9b9ee6d392b6f4f50bacb299e8e1350b1173add8 (diff) | |
download | gcc-cad9aa150ba3ff8c1dc34bf428fc7146dce463b0.tar.gz |
re PR target/42495 (redundant memory load)
PR target/42495
PR middle-end/42574
* basic-block.h (get_dominated_to_depth): Declare.
* dominance.c (get_dominated_to_depth): New function, use
get_all_dominated_blocks as a base.
(get_all_dominated_blocks): Use get_dominated_to_depth.
* gcse.c (occr_t, VEC (occr_t, heap)): Define.
(hoist_exprs): Remove.
(alloc_code_hoist_mem, free_code_hoist_mem): Update.
(compute_code_hoist_vbeinout): Add debug print outs.
(hoist_code): Partially rewrite, simplify. Use get_dominated_to_depth.
* params.def (PARAM_MAX_HOIST_DEPTH): New parameter to avoid
quadratic behavior.
* params.h (MAX_HOIST_DEPTH): New macro.
* doc/invoke.texi (max-hoist-depth): Document.
From-SVN: r162597
Diffstat (limited to 'gcc/dominance.c')
-rw-r--r-- | gcc/dominance.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/dominance.c b/gcc/dominance.c index 2e5f3ee26a2..688c87bff43 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -784,16 +784,20 @@ get_dominated_by_region (enum cdi_direction dir, basic_block *region, } /* Returns the list of basic blocks including BB dominated by BB, in the - direction DIR. The vector will be sorted in preorder. */ + direction DIR up to DEPTH in the dominator tree. The DEPTH of zero will + produce a vector containing all dominated blocks. The vector will be sorted + in preorder. */ VEC (basic_block, heap) * -get_all_dominated_blocks (enum cdi_direction dir, basic_block bb) +get_dominated_to_depth (enum cdi_direction dir, basic_block bb, int depth) { VEC(basic_block, heap) *bbs = NULL; unsigned i; + unsigned next_level_start; i = 0; VEC_safe_push (basic_block, heap, bbs, bb); + next_level_start = 1; /* = VEC_length (basic_block, bbs); */ do { @@ -804,12 +808,24 @@ get_all_dominated_blocks (enum cdi_direction dir, basic_block bb) son; son = next_dom_son (dir, son)) VEC_safe_push (basic_block, heap, bbs, son); + + if (i == next_level_start && --depth) + next_level_start = VEC_length (basic_block, bbs); } - while (i < VEC_length (basic_block, bbs)); + while (i < next_level_start); return bbs; } +/* Returns the list of basic blocks including BB dominated by BB, in the + direction DIR. The vector will be sorted in preorder. */ + +VEC (basic_block, heap) * +get_all_dominated_blocks (enum cdi_direction dir, basic_block bb) +{ + return get_dominated_to_depth (dir, bb, 0); +} + /* Redirect all edges pointing to BB to TO. */ void redirect_immediate_dominators (enum cdi_direction dir, basic_block bb, |