summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-05 04:32:29 +0000
committerxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-05 04:32:29 +0000
commit975f69443b7d144c4c2643a0f26bfa407dca6c6a (patch)
tree29ea22b1a3b319432505318fa869c20b92488ff3
parented2c475e58e891f4e10a46dc544de1db1e2e9123 (diff)
downloadgcc-975f69443b7d144c4c2643a0f26bfa407dca6c6a.tar.gz
2013-01-04 Rong Xu <xur@google.com>
* gcc/value-prof.c (gimple_ic_transform_single_targ): Adjust heuristics. * gcc/doc/invoke.texi: Add new entries. * gcc/params.def (DEFPARAM): Add new entries. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7@194926 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/doc/invoke.texi10
-rw-r--r--gcc/params.def14
-rw-r--r--gcc/value-prof.c9
3 files changed, 31 insertions, 2 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 71d57b79121..5037a8459ba 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9650,6 +9650,16 @@ parameters only when their cumulative size is less or equal to
@option{ipa-sra-ptr-growth-factor} times the size of the original
pointer parameter.
+@item single_icall-promote-target-percent-threshold
+In value profile use compilation, promote a indirect call to a
+conditional direct call only when the percentage of the target count
+is greater or equal to this threshold.
+
+@item single_icall-promote-target_count-threshold
+In value profile use compilation, promote a indirect call to a
+conditional direct call only when the target count is greater or
+equal to this count threshold.
+
@item tm-max-aggregate-size
When making copies of thread-local variables in a transaction, this
parameter specifies the size in bytes after which variables will be
diff --git a/gcc/params.def b/gcc/params.def
index e5f4791f250..2ea0a555961 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -907,6 +907,7 @@ DEFPARAM (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
/* Promote indirect call to conditional direct call only
when the percentage of the target count over the total
indirect call count is no smaller than the threshold. */
+/* For multi-targ indirect_call. */
DEFPARAM (PARAM_ICALL_PROMOTE_PERCENT_THRESHOLD,
"icall-promote-target-percent-threshold",
"percentage threshold for direct call promotion"
@@ -919,6 +920,19 @@ DEFPARAM (PARAM_ICALL_PROMOTE_COUNT_THRESHOLD,
" of a callee target",
1, 0, 0)
+/* For single-targ indirect_call. */
+DEFPARAM (PARAM_SINGLE_ICALL_PROMOTE_PERCENT_THRESHOLD,
+ "single_icall-promote-target-percent-threshold",
+ "percentage threshold for direct call promotion"
+ " of a callee target",
+ 67, 0, 100)
+
+DEFPARAM (PARAM_SINGLE_ICALL_PROMOTE_COUNT_THRESHOLD,
+ "single_icall-promote-target_count-threshold",
+ "call count threshold for direct call promotion"
+ " of a callee target",
+ 1, 0, 0)
+
/* 0: do not always inline icall target:
other value: always inline icall target when call count
exceeds this value.
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 02a98dd3346..81465bcdc5f 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1491,16 +1491,20 @@ gimple_ic_transform_single_targ (gimple stmt, histogram_value histogram)
gcov_type prob;
gimple modify;
struct cgraph_node *direct_call;
+ int perc_threshold, count_threshold;
val = histogram->hvalue.counters [0];
count = histogram->hvalue.counters [1];
all = histogram->hvalue.counters [2];
gimple_remove_histogram_value (cfun, stmt, histogram);
+ bb_all = gimple_bb (stmt)->count;
+
+ perc_threshold = PARAM_VALUE (PARAM_SINGLE_ICALL_PROMOTE_PERCENT_THRESHOLD);
+ count_threshold = PARAM_VALUE (PARAM_SINGLE_ICALL_PROMOTE_COUNT_THRESHOLD);
- if (4 * count <= 3 * all)
+ if (100 * count < bb_all * perc_threshold || count < count_threshold)
return false;
- bb_all = gimple_bb (stmt)->count;
/* The order of CHECK_COUNTER calls is important -
since check_counter can correct the third parameter
and we want to make count <= all <= bb_all. */
@@ -1508,6 +1512,7 @@ gimple_ic_transform_single_targ (gimple stmt, histogram_value histogram)
|| check_counter (stmt, "ic", &count, &all, all))
return false;
+ all = bb_all;
if (all > 0)
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
else