[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass<cutoffs> (PR #124857)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 17:08:01 PST 2025
================
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple,
PB.registerOptimizerLastEPCallback(SanitizersCallback);
}
- if (LowerAllowCheckPass::IsRequested()) {
+ bool lowerAllowCheck = LowerAllowCheckPass::IsRequested();
+ // Is there a non-zero cutoff?
+ static constexpr double SanitizerMaskCutoffsEps = 0.000000001f;
+ for (unsigned int i = 0; i < SanitizerKind::SO_Count; ++i) {
+ lowerAllowCheck |= (CodeGenOpts.SanitizeSkipHotCutoffs[i].value_or(0) >
+ SanitizerMaskCutoffsEps);
+ }
+
+ if (lowerAllowCheck) {
----------------
vitalybuka wrote:
Instead of having this loop, maybe we can intruduce:
`std::optional<vector<int>> SanitizeSkipHotCutoffs::getAllScaled(int Num) const {}`
https://github.com/llvm/llvm-project/pull/124857
More information about the cfe-commits
mailing list