[compiler-rt] r270483 - [profile] clean up runtime warnings.
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Mon May 23 13:08:58 PDT 2016
Author: davidxl
Date: Mon May 23 15:08:58 2016
New Revision: 270483
URL: http://llvm.org/viewvc/llvm-project?rev=270483&view=rev
Log:
[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.
Modified:
compiler-rt/trunk/lib/profile/InstrProfilingValue.c
Modified: compiler-rt/trunk/lib/profile/InstrProfilingValue.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingValue.c?rev=270483&r1=270482&r2=270483&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingValue.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingValue.c Mon May 23 15:08:58 2016
@@ -71,6 +71,8 @@ __llvm_get_function_addr(const __llvm_pr
*/
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(__
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 at 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;
More information about the llvm-commits
mailing list