OSDN Git Service

* gcc.dg/const-elim-1.c: Remove xfail for xtensa-*-*.
[pf3gnuchains/gcc-fork.git] / gcc / predict.c
index 116de35..961a395 100644 (file)
@@ -181,8 +181,7 @@ tree_predicted_by_p (basic_block bb, enum br_predictor predictor)
 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;
 
@@ -434,14 +433,14 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
 
       /* 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));
 
@@ -449,7 +448,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
       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.
@@ -833,8 +832,8 @@ estimate_probability (struct loops *loops_info)
             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)
@@ -1014,7 +1013,7 @@ strip_builtin_expect (void)
              && TREE_CHAIN (arglist))
            {
              TREE_OPERAND (stmt, 1) = TREE_VALUE (arglist);
-             modify_stmt (stmt);
+             update_stmt (stmt);
            }
        }
     }
@@ -1314,7 +1313,7 @@ tree_estimate_probability (void)
             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;
@@ -1440,8 +1439,7 @@ expected_value_to_br_prob (void)
       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);
     }
@@ -1457,8 +1455,8 @@ last_basic_block_p (basic_block bb)
 
   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
@@ -1610,9 +1608,8 @@ propagate_freq (struct loop *loop, bitmap tovisit)
        {
 #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)
@@ -1756,8 +1753,7 @@ expensive_function_p (int threshold)
 
   /* 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
@@ -1811,7 +1807,7 @@ estimate_bb_frequencies (struct loops *loops)
 
       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);