[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;
+  }
----------------
vitalybuka wrote:

Also:
```
if (F.empty())
  return;
```

https://github.com/llvm/llvm-project/pull/83503


More information about the llvm-commits mailing list