[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

Thurston Dang via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 14:33:30 PST 2025


================
@@ -3615,9 +3616,12 @@ void CodeGenFunction::EmitCheck(
 
     if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Checked[i].second))
       NoMerge = true;
+
+    if (!CGM.getCodeGenOpts().NoSanitizeTopHot.has(Checked[i].second))
+      SanitizeGuardChecks = true;
   }
 
-  if (ClSanitizeGuardChecks) {
+  if (SanitizeGuardChecks) {
     llvm::Value *Allow =
         Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::allow_ubsan_check),
                            llvm::ConstantInt::get(CGM.Int8Ty, CheckHandler));
----------------
thurstond wrote:

Instead of passing CheckHandler, can I pass the sanitizer cutoff threshold instead?

Something like
```
        Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::allow_ubsan_check),
                           llvm::ConstantInt::get(CGM.Int8Ty, NoSanitizeTopHot[someIndex]));
```

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


More information about the cfe-commits mailing list