diff options
Diffstat (limited to 'gcc-4.8/gcc/tree-ssa-uninit.c')
-rw-r--r-- | gcc-4.8/gcc/tree-ssa-uninit.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/gcc-4.8/gcc/tree-ssa-uninit.c b/gcc-4.8/gcc/tree-ssa-uninit.c index 2c47fe90b..3fef1794d 100644 --- a/gcc-4.8/gcc/tree-ssa-uninit.c +++ b/gcc-4.8/gcc/tree-ssa-uninit.c @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "tree-pass.h" #include "diagnostic-core.h" +#include "params.h" /* This implements the pass that does predicate aware warning on uses of possibly uninitialized variables. The pass first collects the set of @@ -246,8 +247,8 @@ find_control_equiv_block (basic_block bb) /* Computes the control dependence chains (paths of edges) for DEP_BB up to the dominating basic block BB (the head node of a - chain should be dominated by it). CD_CHAINS is pointer to a - dynamic array holding the result chains. CUR_CD_CHAIN is the current + chain should be dominated by it). CD_CHAINS is pointer to an + array holding the result chains. CUR_CD_CHAIN is the current chain being computed. *NUM_CHAINS is total number of chains. The function returns true if the information is successfully computed, return false if there is no control dependence or not computed. */ @@ -256,7 +257,8 @@ static bool compute_control_dep_chain (basic_block bb, basic_block dep_bb, vec<edge> *cd_chains, size_t *num_chains, - vec<edge> *cur_cd_chain) + vec<edge> *cur_cd_chain, + int *num_calls) { edge_iterator ei; edge e; @@ -267,6 +269,10 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb, if (EDGE_COUNT (bb->succs) < 2) return false; + if (*num_calls > PARAM_VALUE (PARAM_UNINIT_CONTROL_DEP_ATTEMPTS)) + return false; + ++*num_calls; + /* Could use a set instead. */ cur_chain_len = cur_cd_chain->length (); if (cur_chain_len > MAX_CHAIN_LEN) @@ -306,7 +312,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb, /* Now check if DEP_BB is indirectly control dependent on BB. */ if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, - num_chains, cur_cd_chain)) + num_chains, cur_cd_chain, num_calls)) { found_cd_chain = true; break; @@ -438,14 +444,12 @@ find_predicates (vec<use_pred_info_t> **preds, basic_block use_bb) { size_t num_chains = 0, i; - vec<edge> *dep_chains = 0; + int num_calls = 0; + vec<edge> dep_chains[MAX_NUM_CHAINS]; vec<edge> cur_chain = vNULL; bool has_valid_pred = false; basic_block cd_root = 0; - typedef vec<edge> vec_edge_heap; - dep_chains = XCNEWVEC (vec_edge_heap, MAX_NUM_CHAINS); - /* First find the closest bb that is control equivalent to PHI_BB that also dominates USE_BB. */ cd_root = phi_bb; @@ -458,20 +462,16 @@ find_predicates (vec<use_pred_info_t> **preds, break; } - compute_control_dep_chain (cd_root, use_bb, - dep_chains, &num_chains, - &cur_chain); + compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains, + &cur_chain, &num_calls); has_valid_pred - = convert_control_dep_chain_into_preds (dep_chains, - num_chains, - preds, + = convert_control_dep_chain_into_preds (dep_chains, num_chains, preds, num_preds); /* Free individual chain */ cur_chain.release (); for (i = 0; i < num_chains; i++) dep_chains[i].release (); - free (dep_chains); return has_valid_pred; } @@ -539,16 +539,13 @@ find_def_preds (vec<use_pred_info_t> **preds, size_t *num_preds, gimple phi) { size_t num_chains = 0, i, n; - vec<edge> *dep_chains = 0; + vec<edge> dep_chains[MAX_NUM_CHAINS]; vec<edge> cur_chain = vNULL; vec<edge> def_edges = vNULL; bool has_valid_pred = false; basic_block phi_bb, cd_root = 0; struct pointer_set_t *visited_phis; - typedef vec<edge> vec_edge_heap; - dep_chains = XCNEWVEC (vec_edge_heap, MAX_NUM_CHAINS); - phi_bb = gimple_bb (phi); /* First find the closest dominating bb to be the control dependence root */ @@ -567,38 +564,33 @@ find_def_preds (vec<use_pred_info_t> **preds, for (i = 0; i < n; i++) { size_t prev_nc, j; + int num_calls = 0; edge opnd_edge; opnd_edge = def_edges[i]; prev_nc = num_chains; - compute_control_dep_chain (cd_root, opnd_edge->src, - dep_chains, &num_chains, - &cur_chain); - /* Free individual chain */ - cur_chain.release (); + compute_control_dep_chain (cd_root, opnd_edge->src, dep_chains, + &num_chains, &cur_chain, &num_calls); /* Now update the newly added chains with the phi operand edge: */ if (EDGE_COUNT (opnd_edge->src->succs) > 1) { - if (prev_nc == num_chains - && num_chains < MAX_NUM_CHAINS) - num_chains++; + if (prev_nc == num_chains && num_chains < MAX_NUM_CHAINS) + dep_chains[num_chains++] = vNULL; for (j = prev_nc; j < num_chains; j++) - { dep_chains[j].safe_push (opnd_edge); } } - } + + /* Free individual chain */ + cur_chain.release (); has_valid_pred - = convert_control_dep_chain_into_preds (dep_chains, - num_chains, - preds, + = convert_control_dep_chain_into_preds (dep_chains, num_chains, preds, num_preds); for (i = 0; i < num_chains; i++) dep_chains[i].release (); - free (dep_chains); return has_valid_pred; } |