From 050fb2092b4e8fc92243112565f7230e672e4399 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 1 Jun 2016 01:33:08 +0200 Subject: [PATCH] predict-lop-exit-1.C: Update template for new predictor name. * g++.d/predict-lop-exit-1.C: Update template for new predictor name. * g++.d/predict-lop-exit-2.C: Update template for new predictor name. * g++.d/predict-lop-exit-2.C: Update template for new predictor name. * predict.def (PRED_LOOP_EXTRA_EXIT): Define. * predict.c (predict_iv_comparison): Also check PRED_LOOP_EXTRA_EXIT. (predict_extra_loop_exits): Use PRED_LOOP_EXTRA_EXIT instead of PRED_LOOP_EXIT. From-SVN: r236968 --- gcc/ChangeLog | 7 +++++++ gcc/predict.c | 9 +++++---- gcc/predict.def | 5 +++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/predict-loop-exit-1.C | 1 + gcc/testsuite/g++.dg/predict-loop-exit-2.C | 1 + gcc/testsuite/g++.dg/predict-loop-exit-3.C | 1 + 7 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5734b42bfe..45f31d4882c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-05-31 Jan Hubicka + + * predict.def (PRED_LOOP_EXTRA_EXIT): Define. + * predict.c (predict_iv_comparison): Also check PRED_LOOP_EXTRA_EXIT. + (predict_extra_loop_exits): Use PRED_LOOP_EXTRA_EXIT instead of + PRED_LOOP_EXIT. + 2016-05-31 Jan Hubicka * doc/invoke.texi (-frename-registers): Drop -fpeel-loops from list diff --git a/gcc/predict.c b/gcc/predict.c index 396e1505395..e9dda20a0f7 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1245,7 +1245,8 @@ predict_iv_comparison (struct loop *loop, basic_block bb, if (predicted_by_p (bb, PRED_LOOP_ITERATIONS_GUESSED) || predicted_by_p (bb, PRED_LOOP_ITERATIONS) - || predicted_by_p (bb, PRED_LOOP_EXIT)) + || predicted_by_p (bb, PRED_LOOP_EXIT) + || predicted_by_p (bb, PRED_LOOP_EXTRA_EXIT)) return; stmt = last_stmt (bb); @@ -1418,7 +1419,7 @@ predict_iv_comparison (struct loop *loop, basic_block bb, The edge BB7->BB8 is loop exit because BB8 is outside of the loop. From the dataflow, we can infer that BB4->BB6 and BB5->BB6 are also loop exits. This function takes BB7->BB8 as input, and finds out the extra loop - exits to predict them using PRED_LOOP_EXIT. */ + exits to predict them using PRED_LOOP_EXTRA_EXIT. */ static void predict_extra_loop_exits (edge exit_edge) @@ -1474,12 +1475,12 @@ predict_extra_loop_exits (edge exit_edge) continue; if (EDGE_COUNT (e->src->succs) != 1) { - predict_paths_leading_to_edge (e, PRED_LOOP_EXIT, NOT_TAKEN); + predict_paths_leading_to_edge (e, PRED_LOOP_EXTRA_EXIT, NOT_TAKEN); continue; } FOR_EACH_EDGE (e1, ei, e->src->preds) - predict_paths_leading_to_edge (e1, PRED_LOOP_EXIT, NOT_TAKEN); + predict_paths_leading_to_edge (e1, PRED_LOOP_EXTRA_EXIT, NOT_TAKEN); } } diff --git a/gcc/predict.def b/gcc/predict.def index 18ac753a01a..b83ec601da9 100644 --- a/gcc/predict.def +++ b/gcc/predict.def @@ -92,6 +92,11 @@ DEF_PREDICTOR (PRED_LOOP_BRANCH, "loop branch", HITRATE (86), DEF_PREDICTOR (PRED_LOOP_EXIT, "loop exit", HITRATE (91), PRED_FLAG_FIRST_MATCH) +/* Edge causing loop to terminate by computing value used by later conditional. + */ +DEF_PREDICTOR (PRED_LOOP_EXTRA_EXIT, "extra loop exit", HITRATE (91), + PRED_FLAG_FIRST_MATCH) + /* Pointers are usually not NULL. */ DEF_PREDICTOR (PRED_POINTER, "pointer", HITRATE (85), 0) DEF_PREDICTOR (PRED_TREE_POINTER, "pointer (on trees)", HITRATE (85), 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc1624fc366..df648204b59 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-05-31 Jan Hubicka + + * g++.d/predict-lop-exit-1.C: Update template for new predictor name. + * g++.d/predict-lop-exit-2.C: Update template for new predictor name. + * g++.d/predict-lop-exit-2.C: Update template for new predictor name. + 2016-05-31 Paolo Carlini PR c++/71248 diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-1.C b/gcc/testsuite/g++.dg/predict-loop-exit-1.C index c8c202e0a6d..357397f512b 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-1.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-1.C @@ -9,4 +9,5 @@ void test() { return; } +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 2 "profile_estimate"} } */ /* { dg-final { scan-tree-dump-times "loop exit heuristics:" 3 "profile_estimate"} } */ diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-2.C b/gcc/testsuite/g++.dg/predict-loop-exit-2.C index ae18003004e..172fab120c8 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-2.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-2.C @@ -9,4 +9,5 @@ void test() { return; } +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 1 "profile_estimate"} } */ /* { dg-final { scan-tree-dump-times "loop exit heuristics:" 2 "profile_estimate"} } */ diff --git a/gcc/testsuite/g++.dg/predict-loop-exit-3.C b/gcc/testsuite/g++.dg/predict-loop-exit-3.C index 35c768ff031..e6ceec80159 100644 --- a/gcc/testsuite/g++.dg/predict-loop-exit-3.C +++ b/gcc/testsuite/g++.dg/predict-loop-exit-3.C @@ -9,4 +9,5 @@ void test() { return; } +/* { dg-final { scan-tree-dump-times "extra loop exit heuristics:" 2 "profile_estimate"} } */ /* { dg-final { scan-tree-dump-times "loop exit heuristics:" 3 "profile_estimate"} } */ -- 2.30.2