@@ -317,7 +317,7 @@ class HWAddressSanitizer {
317
317
};
318
318
319
319
bool selectiveInstrumentationShouldSkip (Function &F,
320
- FunctionAnalysisManager &FAM);
320
+ FunctionAnalysisManager &FAM) const ;
321
321
void initializeModule ();
322
322
void createHwasanCtorComdat ();
323
323
@@ -1500,28 +1500,24 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
1500
1500
}
1501
1501
1502
1502
bool HWAddressSanitizer::selectiveInstrumentationShouldSkip (
1503
- Function &F, FunctionAnalysisManager &FAM) {
1503
+ Function &F, FunctionAnalysisManager &FAM) const {
1504
1504
if (ClRandomSkipRate.getNumOccurrences ()) {
1505
1505
std::bernoulli_distribution D (ClRandomSkipRate);
1506
- if (D (*Rng))
1507
- return true ;
1508
- } else {
1509
- auto &MAMProxy = FAM.getResult <ModuleAnalysisManagerFunctionProxy>(F);
1510
- ProfileSummaryInfo *PSI =
1511
- MAMProxy.getCachedResult <ProfileSummaryAnalysis>(*F.getParent ());
1512
- if (PSI && PSI->hasProfileSummary ()) {
1513
- auto &BFI = FAM.getResult <BlockFrequencyAnalysis>(F);
1514
- if ((ClHotPercentileCutoff.getNumOccurrences () &&
1515
- ClHotPercentileCutoff >= 0 )
1516
- ? PSI->isFunctionHotInCallGraphNthPercentile (
1517
- ClHotPercentileCutoff, &F, BFI)
1518
- : PSI->isFunctionHotInCallGraph (&F, BFI))
1519
- return true ;
1520
- } else {
1521
- ++NumNoProfileSummaryFuncs;
1522
- }
1506
+ return (D (*Rng));
1523
1507
}
1524
- return false ;
1508
+ auto &MAMProxy = FAM.getResult <ModuleAnalysisManagerFunctionProxy>(F);
1509
+ ProfileSummaryInfo *PSI =
1510
+ MAMProxy.getCachedResult <ProfileSummaryAnalysis>(*F.getParent ());
1511
+ if (!PSI || !PSI->hasProfileSummary ()) {
1512
+ ++NumNoProfileSummaryFuncs;
1513
+ return false ;
1514
+ }
1515
+ auto &BFI = FAM.getResult <BlockFrequencyAnalysis>(F);
1516
+ return (
1517
+ (ClHotPercentileCutoff.getNumOccurrences () && ClHotPercentileCutoff >= 0 )
1518
+ ? PSI->isFunctionHotInCallGraphNthPercentile (ClHotPercentileCutoff,
1519
+ &F, BFI)
1520
+ : PSI->isFunctionHotInCallGraph (&F, BFI));
1525
1521
}
1526
1522
1527
1523
void HWAddressSanitizer::sanitizeFunction (Function &F,
0 commit comments