llvm.org GIT mirror llvm / b06d1c0
The error message for mismatched value sites is very cryptic. Make it more readable for an average user. Differential Revision: https://reviews.llvm.org/D60896 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359043 91177308-0d34-0410-b5e6-96231b3b80d8 Dmitry Mikulin 4 months ago
6 changed file(s) with 38 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
233233 bool canRenameComdatFunc(const Function &F, bool CheckAddressTaken = false);
234234
235235 enum InstrProfValueKind : uint32_t {
236 #define VALUE_PROF_KIND(Enumerator, Value) Enumerator = Value,
236 #define VALUE_PROF_KIND(Enumerator, Value, Descr) Enumerator = Value,
237237 #include "llvm/ProfileData/InstrProfData.inc"
238238 };
239239
168168
169169 /* VALUE_PROF_KIND start */
170170 #ifndef VALUE_PROF_KIND
171 #define VALUE_PROF_KIND(Enumerator, Value)
171 #define VALUE_PROF_KIND(Enumerator, Value, Descr)
172172 #else
173173 #define INSTR_PROF_DATA_DEFINED
174174 #endif
181181 * For this remapping the ProfData is used. ProfData contains both the function
182182 * name hash and the function address.
183183 */
184 VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0)
184 VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0, "indirect call target")
185185 /* For memory intrinsic functions size profiling. */
186 VALUE_PROF_KIND(IPVK_MemOPSize, 1)
186 VALUE_PROF_KIND(IPVK_MemOPSize, 1, "memory intrinsic functions size")
187187 /* These two kinds must be the last to be
188188 * declared. This is to make sure the string
189189 * array created with the template can be
190190 * indexed with the kind value.
191191 */
192 VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget)
193 VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize)
192 VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget, "first")
193 VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize, "last")
194194
195195 #undef VALUE_PROF_KIND
196196 /* VALUE_PROF_KIND end */
356356 }
357357
358358 static const char *ValueProfKindStr[] = {
359 #define VALUE_PROF_KIND(Enumerator, Value) #Enumerator,
359 #define VALUE_PROF_KIND(Enumerator, Value, Descr) #Enumerator,
360360 #include "llvm/ProfileData/InstrProfData.inc"
361361 };
362362
14251425 annotateValueSites(Kind);
14261426 }
14271427
1428 static const char *ValueProfKindDescr[] = {
1429 #define VALUE_PROF_KIND(Enumerator, Value, Descr) Descr,
1430 #include "llvm/ProfileData/InstrProfData.inc"
1431 };
1432
14281433 // Annotate the instructions for a specific value kind.
14291434 void PGOUseFunc::annotateValueSites(uint32_t Kind) {
1435 assert(Kind <= IPVK_Last);
14301436 unsigned ValueSiteIndex = 0;
14311437 auto &ValueSites = FuncInfo.ValueSites[Kind];
14321438 unsigned NumValueSites = ProfileRecord.getNumValueSites(Kind);
14341440 auto &Ctx = M->getContext();
14351441 Ctx.diagnose(DiagnosticInfoPGOProfile(
14361442 M->getName().data(),
1437 Twine("Inconsistent number of value sites for kind = ") + Twine(Kind) +
1438 " in " + F.getName().str(),
1443 Twine("Inconsistent number of value sites for ") +
1444 Twine(ValueProfKindDescr[Kind]) +
1445 Twine(" profiling in \"") + F.getName().str() +
1446 Twine("\", possibly due to the use of a stale profile."),
14391447 DS_Warning));
14401448 return;
14411449 }
0 # :ir is the flag to indicate this is IR level profile.
1 :ir
2 foo
3 12884901887
4 1
5 1
0 ; RUN: llvm-profdata merge %S/Inputs/diag_no_value_sites.proftext -o %t.profdata
1 ; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s
2
3 ; CHECK: Inconsistent number of value sites for memory intrinsic functions size profiling
4
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
7
8 define void @foo(i8* %dst, i8* %src, i64 %n) {
9 entry:
10 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %n, i1 false)
11 ret void
12 }
13
14 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)