[llvm] [HWASAN] Implement selective instrumentation based on profiling information (PR #83503)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 15:57:24 PST 2024
================
@@ -1501,11 +1520,39 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
void HWAddressSanitizer::sanitizeFunction(Function &F,
FunctionAnalysisManager &FAM) {
- if (&F == HwasanCtorFunction)
+ NumTotalFuncs++;
+ if (&F == HwasanCtorFunction) {
+ NumHwasanCtors++;
return;
+ }
- if (!F.hasFnAttribute(Attribute::SanitizeHWAddress))
+ if (!F.hasFnAttribute(Attribute::SanitizeHWAddress)) {
+ NumNoSanitizeFuncs++;
return;
+ }
+
+ NumConsideredFuncs++;
+ if (CSkipHotCode) {
+ auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
+ ProfileSummaryInfo *PSI =
+ MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
+ if (PSI != nullptr && PSI->hasProfileSummary()) {
----------------
vitalybuka wrote:
just `PSI &&`
https://github.com/llvm/llvm-project/pull/83503
More information about the llvm-commits
mailing list