diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -765,9 +765,8 @@ // If profile is CS, the function offset section is expected to consist of // sequences of contexts in pre-order layout // (e.g. [A, A:1 @ B, A:1 @ B:2.3 @ C] [D, D:1 @ E]), so that when a matched - // context in the module is found, the profiles of all its prefix contexts ( - // all callers on the call stack) are loaded. A list is needed since the order - // of profiles matters. + // context in the module is found, the profiles of all its callees are + // recursively loaded. A list is needed since the order of profiles matters. if (ProfileIsCS) return true; @@ -861,6 +860,7 @@ } if (ProfileIsCS) { + assert(useFuncOffsetList()); DenseSet FuncGuidsToUse; if (useMD5()) { for (auto Name : FuncsToUse) @@ -898,6 +898,7 @@ } } } else if (useMD5()) { + assert(!useFuncOffsetList()); for (auto Name : FuncsToUse) { auto GUID = std::to_string(MD5Hash(Name)); auto iter = FuncOffsetTable.find(StringRef(GUID)); @@ -908,6 +909,7 @@ return EC; } } else if (Remapper) { + assert(useFuncOffsetList()); for (auto NameOffset : FuncOffsetList) { SampleContext FContext(NameOffset.first); auto FuncName = FContext.getName(); @@ -918,6 +920,7 @@ return EC; } } else { + assert(!useFuncOffsetList()); for (auto Name : FuncsToUse) { auto iter = FuncOffsetTable.find(Name); if (iter == FuncOffsetTable.end())