diff options
author | Xinliang David Li <davidxl@google.com> | 2016-05-23 20:08:58 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-05-23 20:08:58 +0000 |
commit | 66a891962b3dd66cff48aa27a613e17a3ecae389 (patch) | |
tree | 7416992c37dab3611263043e380f08296e21477c | |
parent | cc1b82be17a8a100857cd1830d8704a8531f11d9 (diff) | |
download | bcm5719-llvm-66a891962b3dd66cff48aa27a613e17a3ecae389.tar.gz bcm5719-llvm-66a891962b3dd66cff48aa27a613e17a3ecae389.zip |
[profile] clean up runtime warnings.
o make warning message more meaningful to users.
o add suggestion to fix the problem
o limit the max number of output.
llvm-svn: 270483
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingValue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingValue.c b/compiler-rt/lib/profile/InstrProfilingValue.c index c78e75540f8..23690c991de 100644 --- a/compiler-rt/lib/profile/InstrProfilingValue.c +++ b/compiler-rt/lib/profile/InstrProfilingValue.c @@ -71,6 +71,8 @@ __llvm_get_function_addr(const __llvm_profile_data *Data) { */ static int hasStaticCounters = 1; +static int OutOfNodesWarnings = 0; +#define MAX_VP_WARNS 10 static int allocateValueProfileCounters(__llvm_profile_data *Data) { uint64_t NumVSites = 0; @@ -102,9 +104,11 @@ static ValueProfNode *allocateOneNode(__llvm_profile_data *Data, uint32_t Index, return (ValueProfNode *)calloc(1, sizeof(ValueProfNode)); Node = COMPILER_RT_PTR_FETCH_ADD(ValueProfNode, CurrentVNode, 1); - if (Node >= EndVNode) { - PROF_WARN("Running out of nodes: site_%d@func_%" PRIu64 - ", value=%" PRIu64 " \n", Index, Data->NameRef, Value); + if (Node >= EndVNode && (OutOfNodesWarnings ++ < MAX_VP_WARNS)) { + PROF_WARN("Unable to track new values: %s. " + " Consider using option -mllvm -vp-counters-per-site=<n> to allocate more" + " value profile counters at compile time. \n", + "Running out of static counters"); return 0; } return Node; |