Skip to content

Commit 8a09260

Browse files
committed
tweak comments
1 parent 30f0940 commit 8a09260

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ static cl::opt<unsigned> HotFuncCutoffForStalenessError(
242242
static cl::opt<unsigned> MinfuncsForStalenessError(
243243
"min-functions-for-staleness-error", cl::Hidden, cl::init(50),
244244
cl::desc("Skip the check if the number of hot functions is smaller than "
245-
"the given number."));
245+
"the specified number."));
246246

247247
static cl::opt<unsigned> PrecentMismatchForStalenessError(
248248
"precent-mismatch-for-staleness-error", cl::Hidden, cl::init(80),
249249
cl::desc("Reject the profile if the mismatch percent is higher than the "
250-
"given number"));
250+
"given number."));
251251

252252
static cl::opt<bool> CallsitePrioritizedInline(
253253
"sample-profile-prioritized-inline", cl::Hidden,
@@ -2207,15 +2207,13 @@ bool SampleProfileLoader::doInitialization(Module &M,
22072207
// Note that this is a module-level check. Even if one module is errored out,
22082208
// the entire build will be errored out. However, the user could make big
22092209
// changes to functions in single module but those changes might not be
2210-
// performance significant to the whole binary. Therefore, we use a conservative
2211-
// approach to make sure we only error out if it globally impacts the binary
2212-
// performance. To achieve this, we use heuristics to select a reasonable
2213-
// big set of functions that are supposed to be globally performance
2214-
// significant, only compute and check the mismatch within those functions. The
2215-
// function selection is based on two criteria: 1) The function is "hot" enough,
2216-
// which is tuned by a hotness-based flag(HotFuncCutoffForStalenessError). 2)
2217-
// The num of function is large enough which is tuned by the
2218-
// MinfuncsForStalenessError flag.
2210+
// performance significant to the whole binary. Therefore, to avoid those false
2211+
// positives, we select a reasonable big set of hot functions that are supposed
2212+
// to be globally performance significant, only compute and check the mismatch
2213+
// within those functions. The function selection is based on two criteria:
2214+
// 1) The function is hot enough, which is tuned by a hotness-based
2215+
// flag(HotFuncCutoffForStalenessError). 2) The num of function is large enough
2216+
// which is tuned by the MinfuncsForStalenessError flag.
22192217
bool SampleProfileLoader::rejectHighStalenessProfile(
22202218
Module &M, ProfileSummaryInfo *PSI, const SampleProfileMap &Profiles) {
22212219
assert(FunctionSamples::ProfileIsProbeBased &&
@@ -2228,11 +2226,7 @@ bool SampleProfileLoader::rejectHighStalenessProfile(
22282226
if (!FuncDesc)
22292227
continue;
22302228

2231-
// We want to select a set of functions that are globally performance
2232-
// significant, in other words, if those functions profiles are
2233-
// checksum-mismatched and dropped, the whole binary will likely be
2234-
// impacted, so here we use a hotness-based threshold to control the
2235-
// selection.
2229+
// Use a hotness-based threshold to control the function selection.
22362230
if (!PSI->isHotCountNthPercentile(HotFuncCutoffForStalenessError,
22372231
FS.getTotalSamples()))
22382232
continue;
@@ -2791,7 +2785,6 @@ bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
27912785
PSI->refresh();
27922786
}
27932787

2794-
// Error out if the profile checksum mismatch is too high.
27952788
if (FunctionSamples::ProfileIsProbeBased &&
27962789
rejectHighStalenessProfile(M, PSI, Reader->getProfiles()))
27972790
return false;

0 commit comments

Comments
 (0)