static void
predict_insn (rtx insn, enum br_predictor predictor, int probability)
{
- if (!any_condjump_p (insn))
- abort ();
+ gcc_assert (any_condjump_p (insn));
if (!flag_guess_branch_prob)
return;
/* Save the prediction into CFG in case we are seeing non-degenerated
conditional jump. */
- if (EDGE_COUNT (bb->succs) > 1)
+ if (!single_succ_p (bb))
{
BRANCH_EDGE (bb)->probability = combined_probability;
FALLTHRU_EDGE (bb)->probability
= REG_BR_PROB_BASE - combined_probability;
}
}
- else if (EDGE_COUNT (bb->succs) > 1)
+ else if (!single_succ_p (bb))
{
int prob = INTVAL (XEXP (prob_note, 0));
FALLTHRU_EDGE (bb)->probability = REG_BR_PROB_BASE - prob;
}
else
- EDGE_SUCC (bb, 0)->probability = REG_BR_PROB_BASE;
+ single_succ_edge (bb)->probability = REG_BR_PROB_BASE;
}
/* Combine predictions into single probability and store them into CFG.
{
basic_block bb, *bbs;
unsigned j;
- int exits;
+ unsigned n_exits;
struct loop *loop = loops_info->parray[i];
struct niter_desc desc;
unsigned HOST_WIDE_INT niter;
+ edge *exits;
- flow_loop_scan (loop, LOOP_EXIT_EDGES);
- exits = loop->num_exits;
+ exits = get_loop_exit_edges (loop, &n_exits);
if (rtlsimpleloops)
{
}
else
{
- edge *exits;
- unsigned j, n_exits;
struct tree_niter_desc niter_desc;
- exits = get_loop_exit_edges (loop, &n_exits);
for (j = 0; j < n_exits; j++)
{
tree niter = NULL;
}
}
- free (exits);
}
+ free (exits);
bbs = get_loop_body (loop);
(e, PRED_LOOP_EXIT,
(REG_BR_PROB_BASE
- predictor_info [(int) PRED_LOOP_EXIT].hitrate)
- / exits);
+ / n_exits);
}
/* Free basic blocks from get_loop_body. */
}
if (!rtlsimpleloops)
- scev_finalize ();
+ {
+ scev_finalize ();
+ current_loops = NULL;
+ }
}
/* Attempt to predict probabilities of BB outgoing edges using local
care for error returns and other are often used for fast paths
trought function. */
if ((e->dest == EXIT_BLOCK_PTR
- || (EDGE_COUNT (e->dest->succs) == 1
- && EDGE_SUCC (e->dest, 0)->dest == EXIT_BLOCK_PTR))
+ || (single_succ_p (e->dest)
+ && single_succ (e->dest) == EXIT_BLOCK_PTR))
&& !predicted_by_p (bb, PRED_NULL_RETURN)
&& !predicted_by_p (bb, PRED_CONST_RETURN)
&& !predicted_by_p (bb, PRED_NEGATIVE_RETURN)
&& TREE_CHAIN (arglist))
{
TREE_OPERAND (stmt, 1) = TREE_VALUE (arglist);
- modify_stmt (stmt);
+ update_stmt (stmt);
}
}
}
|| !SSA_NAME_DEF_STMT (return_val)
|| TREE_CODE (SSA_NAME_DEF_STMT (return_val)) != PHI_NODE)
return;
- phi = SSA_NAME_DEF_STMT (return_val);
- while (phi)
- {
- tree next = PHI_CHAIN (phi);
- if (PHI_RESULT (phi) == return_val)
- break;
- phi = next;
- }
+ for (phi = SSA_NAME_DEF_STMT (return_val); phi; phi = PHI_CHAIN (phi))
+ if (PHI_RESULT (phi) == return_val)
+ break;
if (!phi)
return;
phi_num_args = PHI_NUM_ARGS (phi);
basic_block bb;
struct loops loops_info;
- flow_loops_find (&loops_info, LOOP_TREE);
+ flow_loops_find (&loops_info);
if (dump_file && (dump_flags & TDF_DETAILS))
flow_loops_dump (&loops_info, dump_file, NULL, 0);
fast paths trought function. */
if (e->dest == EXIT_BLOCK_PTR
&& TREE_CODE (last_stmt (bb)) == RETURN_EXPR
- && EDGE_COUNT (bb->preds) > 1)
+ && !single_pred_p (bb))
{
edge e1;
edge_iterator ei1;
cond = simplify_rtx (cond);
/* Turn the condition into a scaled branch probability. */
- if (cond != const_true_rtx && cond != const0_rtx)
- abort ();
+ gcc_assert (cond == const_true_rtx || cond == const0_rtx);
predict_insn_def (insn, PRED_BUILTIN_EXPECT,
cond == const_true_rtx ? TAKEN : NOT_TAKEN);
}
return (bb->next_bb == EXIT_BLOCK_PTR
|| (bb->next_bb->next_bb == EXIT_BLOCK_PTR
- && EDGE_COUNT (bb->succs) == 1
- && EDGE_SUCC (bb, 0)->dest->next_bb == EXIT_BLOCK_PTR));
+ && single_succ_p (bb)
+ && single_succ (bb)->next_bb == EXIT_BLOCK_PTR));
}
/* Sets branch probabilities according to PREDiction and
{
#ifdef ENABLE_CHECKING
FOR_EACH_EDGE (e, ei, bb->preds)
- if (bitmap_bit_p (tovisit, e->src->index)
- && !(e->flags & EDGE_DFS_BACK))
- abort ();
+ gcc_assert (!bitmap_bit_p (tovisit, e->src->index)
+ || (e->flags & EDGE_DFS_BACK));
#endif
FOR_EACH_EDGE (e, ei, bb->preds)
/* We can not compute accurately for large thresholds due to scaled
frequencies. */
- if (threshold > BB_FREQ_MAX)
- abort ();
+ gcc_assert (threshold <= BB_FREQ_MAX);
/* Frequencies are out of range. This either means that function contains
internal loop executing more than BB_FREQ_MAX times or profile feedback
mark_dfs_back_edges ();
- EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->probability = REG_BR_PROB_BASE;
+ single_succ_edge (ENTRY_BLOCK_PTR)->probability = REG_BR_PROB_BASE;
/* Set up block info for each basic block. */
tovisit = BITMAP_ALLOC (NULL);