diff options
author | Richard Biener <rguenther@suse.de> | 2019-11-21 13:46:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-11-21 13:46:18 +0000 |
commit | d78b70959f334699bf556e9b8d4e0a8c12a64b46 (patch) | |
tree | bbeb4dbda1117ae17d50415a6053d914cf30f236 /gcc/cfganal.c | |
parent | e2a05fdfd4798192493c582ec6528c975bfa9b0c (diff) | |
download | gcc-d78b70959f334699bf556e9b8d4e0a8c12a64b46.zip gcc-d78b70959f334699bf556e9b8d4e0a8c12a64b46.tar.gz gcc-d78b70959f334699bf556e9b8d4e0a8c12a64b46.tar.bz2 |
cfgloop.h (loop_iterator::~loop_iterator): Remove.
2019-11-21 Richard Biener <rguenther@suse.de>
* cfgloop.h (loop_iterator::~loop_iterator): Remove.
(loop_iterator::to_visit): Use an auto_vec with internal storage.
(loop_iterator::loop_iterator): Adjust.
* cfganal.c (compute_dominance_frontiers_1): Fold into...
(compute_dominance_frontiers): ... this. Hoist invariant
get_immediate_dominator call.
(compute_idf): Use a work-set instead of a work-list for more
optimal iteration order and duplicate avoidance.
* tree-into-ssa.c (mark_phi_for_rewrite): Avoid re-allocating
the vector all the time, instead pre-allocate the vector only
once.
(delete_update_ssa): Simplify.
* vec.h (va_heap::release): Disable -Wfree-nonheap-object around it.
From-SVN: r278550
Diffstat (limited to 'gcc/cfganal.c')
-rw-r--r-- | gcc/cfganal.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 45ebd1e..039769d 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -1326,10 +1326,11 @@ dfs_enumerate_from (basic_block bb, int reverse, of the dominance frontiers, no more, no less. */ - -static void -compute_dominance_frontiers_1 (bitmap_head *frontiers) +void +compute_dominance_frontiers (bitmap_head *frontiers) { + timevar_push (TV_DOM_FRONTIERS); + edge p; edge_iterator ei; basic_block b; @@ -1337,34 +1338,22 @@ compute_dominance_frontiers_1 (bitmap_head *frontiers) { if (EDGE_COUNT (b->preds) >= 2) { + basic_block domsb = get_immediate_dominator (CDI_DOMINATORS, b); FOR_EACH_EDGE (p, ei, b->preds) { basic_block runner = p->src; - basic_block domsb; if (runner == ENTRY_BLOCK_PTR_FOR_FN (cfun)) continue; - domsb = get_immediate_dominator (CDI_DOMINATORS, b); while (runner != domsb) { - if (!bitmap_set_bit (&frontiers[runner->index], - b->index)) + if (!bitmap_set_bit (&frontiers[runner->index], b->index)) break; - runner = get_immediate_dominator (CDI_DOMINATORS, - runner); + runner = get_immediate_dominator (CDI_DOMINATORS, runner); } } } } -} - - -void -compute_dominance_frontiers (bitmap_head *frontiers) -{ - timevar_push (TV_DOM_FRONTIERS); - - compute_dominance_frontiers_1 (frontiers); timevar_pop (TV_DOM_FRONTIERS); } @@ -1385,25 +1374,26 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs) unsigned bb_index, i; bitmap phi_insertion_points; - /* Each block can appear at most twice on the work-stack. */ - auto_vec<int> work_stack (2 * n_basic_blocks_for_fn (cfun)); phi_insertion_points = BITMAP_ALLOC (NULL); - /* Seed the work list with all the blocks in DEF_BLOCKS. We use - vec::quick_push here for speed. This is safe because we know that - the number of definition blocks is no greater than the number of - basic blocks, which is the initial capacity of WORK_STACK. */ - EXECUTE_IF_SET_IN_BITMAP (def_blocks, 0, bb_index, bi) - work_stack.quick_push (bb_index); + /* Seed the work set with all the blocks in DEF_BLOCKS. */ + auto_bitmap work_set; + bitmap_copy (work_set, def_blocks); + bitmap_tree_view (work_set); - /* Pop a block off the worklist, add every block that appears in + /* Pop a block off the workset, add every block that appears in the original block's DF that we have not already processed to - the worklist. Iterate until the worklist is empty. Blocks - which are added to the worklist are potential sites for + the workset. Iterate until the workset is empty. Blocks + which are added to the workset are potential sites for PHI nodes. */ - while (work_stack.length () > 0) + while (!bitmap_empty_p (work_set)) { - bb_index = work_stack.pop (); + /* The dominance frontier of a block is blocks after it so iterating + on earlier blocks first is better. + ??? Basic blocks are by no means guaranteed to be ordered in + optimal order for this iteration. */ + bb_index = bitmap_first_set_bit (work_set); + bitmap_clear_bit (work_set, bb_index); /* Since the registration of NEW -> OLD name mappings is done separately from the call to update_ssa, when updating the SSA @@ -1416,7 +1406,7 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs) EXECUTE_IF_AND_COMPL_IN_BITMAP (&dfs[bb_index], phi_insertion_points, 0, i, bi) { - work_stack.quick_push (i); + bitmap_set_bit (work_set, i); bitmap_set_bit (phi_insertion_points, i); } } |