@@ -242,12 +242,12 @@ static cl::opt<unsigned> HotFuncCutoffForStalenessError(
242
242
static cl::opt<unsigned > MinfuncsForStalenessError (
243
243
" min-functions-for-staleness-error" , cl::Hidden, cl::init(50 ),
244
244
cl::desc(" Skip the check if the number of hot functions is smaller than "
245
- " the given number." ));
245
+ " the specified number." ));
246
246
247
247
static cl::opt<unsigned > PrecentMismatchForStalenessError (
248
248
" precent-mismatch-for-staleness-error" , cl::Hidden, cl::init(80 ),
249
249
cl::desc(" Reject the profile if the mismatch percent is higher than the "
250
- " given number" ));
250
+ " given number. " ));
251
251
252
252
static cl::opt<bool > CallsitePrioritizedInline (
253
253
" sample-profile-prioritized-inline" , cl::Hidden,
@@ -2207,15 +2207,13 @@ bool SampleProfileLoader::doInitialization(Module &M,
2207
2207
// Note that this is a module-level check. Even if one module is errored out,
2208
2208
// the entire build will be errored out. However, the user could make big
2209
2209
// 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.
2219
2217
bool SampleProfileLoader::rejectHighStalenessProfile (
2220
2218
Module &M, ProfileSummaryInfo *PSI, const SampleProfileMap &Profiles) {
2221
2219
assert (FunctionSamples::ProfileIsProbeBased &&
@@ -2228,11 +2226,7 @@ bool SampleProfileLoader::rejectHighStalenessProfile(
2228
2226
if (!FuncDesc)
2229
2227
continue ;
2230
2228
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.
2236
2230
if (!PSI->isHotCountNthPercentile (HotFuncCutoffForStalenessError,
2237
2231
FS.getTotalSamples ()))
2238
2232
continue ;
@@ -2791,7 +2785,6 @@ bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
2791
2785
PSI->refresh ();
2792
2786
}
2793
2787
2794
- // Error out if the profile checksum mismatch is too high.
2795
2788
if (FunctionSamples::ProfileIsProbeBased &&
2796
2789
rejectHighStalenessProfile (M, PSI, Reader->getProfiles ()))
2797
2790
return false ;
0 commit comments