summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2016-06-25 13:56:52 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2016-06-25 11:56:52 +0000
commit888ed1a39a46d55a7c1f2357d31eb4b59e4dc721 (patch)
tree412e6f58c87e87e9651ee2208731ac15e90260c8 /gcc/predict.c
parent1527dee9df41b5130f0d767f91bc89f9c990535c (diff)
downloadgcc-888ed1a39a46d55a7c1f2357d31eb4b59e4dc721.tar.gz
predict.c: Include ipa-utils.h
* predict.c: Include ipa-utils.h (tree_bb_level_prediction): Predict recursive calls. (tree_estimate_probability_bb): Skip inexpensive calls for call predictor. * predict.def (PRED_RECURSIVE_CALL): New. * gcc.dg/predict-10.c: New test. From-SVN: r237780
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index d505d9c4cc8..cc4302b1b7e 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"
#include "tree-scalar-evolution.h"
+#include "ipa-utils.h"
/* Enum with reasons why a predictor is ignored. */
@@ -2425,6 +2426,9 @@ tree_bb_level_predictions (void)
DECL_ATTRIBUTES (decl)))
predict_paths_leading_to (bb, PRED_COLD_FUNCTION,
NOT_TAKEN);
+ if (decl && recursive_call_p (current_function_decl, decl))
+ predict_paths_leading_to (bb, PRED_RECURSIVE_CALL,
+ NOT_TAKEN);
}
else if (gimple_code (stmt) == GIMPLE_PREDICT)
{
@@ -2539,6 +2543,7 @@ tree_estimate_probability_bb (basic_block bb)
{
gimple *stmt = gsi_stmt (bi);
if (is_gimple_call (stmt)
+ && !gimple_inexpensive_call_p (as_a <gcall *> (stmt))
/* Constant and pure calls are hardly used to signalize
something exceptional. */
&& gimple_has_side_effects (stmt))