[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 6 14:19:04 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));
----------------
vitalybuka wrote:
It's maybe not important for the patch, but we will have a problem here.
LLVM pass will need to lookup fraction by the argument,
but the argument is `CheckHandler` which is not the same as NoSanitizeTopHot.
but maybe we need to think a little bit now.
Assuming very few `Checked.size() > 1` also `Checked[i].second` is usually 1 bit.
Probably correct approach will be to apply llvm::Intrinsic::allow_ubsan_check on line 3606?
And use the bit with with highest sanitizer coverage as ID.
WDYT?
https://github.com/llvm/llvm-project/pull/121619
More information about the cfe-commits
mailing list