diff options
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index bafcc96fbc5..642bd6287a0 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -835,7 +835,8 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) int probability = INTVAL (XEXP (XEXP (note, 0), 1)); found = true; - if (best_predictor > predictor) + if (best_predictor > predictor + && predictor_info[predictor].flags & PRED_FLAG_FIRST_MATCH) best_probability = probability, best_predictor = predictor; d = (combined_probability * probability @@ -855,7 +856,7 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) use no_prediction heuristic, in case we did match, use either first match or Dempster-Shaffer theory depending on the flags. */ - if (predictor_info [best_predictor].flags & PRED_FLAG_FIRST_MATCH) + if (best_predictor != END_PREDICTORS) first_match = true; if (!found) @@ -863,10 +864,12 @@ combine_predictions_for_insn (rtx_insn *insn, basic_block bb) combined_probability, bb); else { - dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, - bb, !first_match ? REASON_NONE : REASON_IGNORED); - dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, - bb, first_match ? REASON_NONE : REASON_IGNORED); + if (!first_match) + dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, + bb, !first_match ? REASON_NONE : REASON_IGNORED); + else + dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, + bb, first_match ? REASON_NONE : REASON_IGNORED); } if (first_match) @@ -1096,7 +1099,8 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) found = true; /* First match heuristics would be widly confused if we predicted both directions. */ - if (best_predictor > predictor) + if (best_predictor > predictor + && predictor_info[predictor].flags & PRED_FLAG_FIRST_MATCH) { struct edge_prediction *pred2; int prob = probability; @@ -1142,17 +1146,19 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) use no_prediction heuristic, in case we did match, use either first match or Dempster-Shaffer theory depending on the flags. */ - if (predictor_info [best_predictor].flags & PRED_FLAG_FIRST_MATCH) + if (best_predictor != END_PREDICTORS) first_match = true; if (!found) dump_prediction (dump_file, PRED_NO_PREDICTION, combined_probability, bb); else { - dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, bb, - !first_match ? REASON_NONE : REASON_IGNORED); - dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, bb, - first_match ? REASON_NONE : REASON_IGNORED); + if (!first_match) + dump_prediction (dump_file, PRED_DS_THEORY, combined_probability, bb, + !first_match ? REASON_NONE : REASON_IGNORED); + else + dump_prediction (dump_file, PRED_FIRST_MATCH, best_probability, bb, + first_match ? REASON_NONE : REASON_IGNORED); } if (first_match) |