diff options
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r-- | gcc/cfgloopmanip.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 99b41d7ceae..4568833065b 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -276,8 +276,9 @@ bool remove_path (edge e) { edge ae; - basic_block *rem_bbs, *bord_bbs, *dom_bbs, from, bb; - int i, nrem, n_bord_bbs, n_dom_bbs, nreml; + basic_block *rem_bbs, *bord_bbs, from, bb; + VEC (basic_block, heap) *dom_bbs; + int i, nrem, n_bord_bbs, nreml; sbitmap seen; bool irred_invalidated = false; struct loop **deleted_loop; @@ -338,7 +339,7 @@ remove_path (edge e) /* Remove the path. */ from = e->src; remove_branch (e); - dom_bbs = XCNEWVEC (basic_block, n_basic_blocks); + dom_bbs = NULL; /* Cancel loops contained in the path. */ deleted_loop = XNEWVEC (struct loop *, nrem); @@ -355,7 +356,6 @@ remove_path (edge e) free (deleted_loop); /* Find blocks whose dominators may be affected. */ - n_dom_bbs = 0; sbitmap_zero (seen); for (i = 0; i < n_bord_bbs; i++) { @@ -370,14 +370,14 @@ remove_path (edge e) ldom; ldom = next_dom_son (CDI_DOMINATORS, ldom)) if (!dominated_by_p (CDI_DOMINATORS, from, ldom)) - dom_bbs[n_dom_bbs++] = ldom; + VEC_safe_push (basic_block, heap, dom_bbs, ldom); } free (seen); /* Recount dominators. */ - iterate_fix_dominators (CDI_DOMINATORS, dom_bbs, n_dom_bbs); - free (dom_bbs); + iterate_fix_dominators (CDI_DOMINATORS, dom_bbs, true); + VEC_free (basic_block, heap, dom_bbs); free (bord_bbs); /* Fix placements of basic blocks inside loops and the placement of @@ -472,8 +472,9 @@ loopify (edge latch_edge, edge header_edge, { basic_block succ_bb = latch_edge->dest; basic_block pred_bb = header_edge->src; - basic_block *dom_bbs, *body; - unsigned n_dom_bbs, i; + basic_block *body; + VEC (basic_block, heap) *dom_bbs; + unsigned i; sbitmap seen; struct loop *loop = alloc_loop (); struct loop *outer = loop_outer (succ_bb->loop_father); @@ -528,8 +529,7 @@ loopify (edge latch_edge, edge header_edge, scale_loop_frequencies (succ_bb->loop_father, true_scale, REG_BR_PROB_BASE); /* Update dominators of blocks outside of LOOP. */ - dom_bbs = XCNEWVEC (basic_block, n_basic_blocks); - n_dom_bbs = 0; + dom_bbs = NULL; seen = sbitmap_alloc (last_basic_block); sbitmap_zero (seen); body = get_loop_body (loop); @@ -547,15 +547,15 @@ loopify (edge latch_edge, edge header_edge, if (!TEST_BIT (seen, ldom->index)) { SET_BIT (seen, ldom->index); - dom_bbs[n_dom_bbs++] = ldom; + VEC_safe_push (basic_block, heap, dom_bbs, ldom); } } - iterate_fix_dominators (CDI_DOMINATORS, dom_bbs, n_dom_bbs); + iterate_fix_dominators (CDI_DOMINATORS, dom_bbs, false); free (body); free (seen); - free (dom_bbs); + VEC_free (basic_block, heap, dom_bbs); return loop; } @@ -1054,23 +1054,23 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, /* Update dominators of outer blocks if affected. */ for (i = 0; i < n; i++) { - basic_block dominated, dom_bb, *dom_bbs; - int n_dom_bbs,j; + basic_block dominated, dom_bb; + VEC (basic_block, heap) *dom_bbs; + unsigned j; bb = bbs[i]; bb->aux = 0; - n_dom_bbs = get_dominated_by (CDI_DOMINATORS, bb, &dom_bbs); - for (j = 0; j < n_dom_bbs; j++) + dom_bbs = get_dominated_by (CDI_DOMINATORS, bb); + for (j = 0; VEC_iterate (basic_block, dom_bbs, j, dominated); j++) { - dominated = dom_bbs[j]; if (flow_bb_inside_loop_p (loop, dominated)) continue; dom_bb = nearest_common_dominator ( CDI_DOMINATORS, first_active[i], first_active_latch); set_immediate_dominator (CDI_DOMINATORS, dominated, dom_bb); } - free (dom_bbs); + VEC_free (basic_block, heap, dom_bbs); } free (first_active); |