[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass<cutoffs> (PR #124857)
Thurston Dang via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 29 16:48:34 PST 2025
================
@@ -795,12 +795,30 @@ static void addSanitizers(const Triple &TargetTriple,
PB.registerOptimizerLastEPCallback(SanitizersCallback);
}
- if (LowerAllowCheckPass::IsRequested()) {
+ // SanitizeSkipHotCutoffs: doubles with range [0, 1]
+ // Opts.cutoffs: ints with range [0, 1000000]
+ std::optional<std::vector<int>> scaledCutoffs =
+ CodeGenOpts.SanitizeSkipHotCutoffs.getAllScaled(1000000);
+
+ // TODO: remove IsRequested()
+ if (LowerAllowCheckPass::IsRequested() || scaledCutoffs.has_value()) {
// We want to call it after inline, which is about OptimizerEarlyEPCallback.
PB.registerOptimizerEarlyEPCallback([&](ModulePassManager &MPM,
OptimizationLevel Level,
ThinOrFullLTOPhase Phase) {
LowerAllowCheckPass::Options Opts;
+
+ // TODO: after removing IsRequested(), the if case will be unconditional
----------------
thurstond wrote:
unsigned makes sense for Opts.cutoffs. But it seems unnecessarily restrictive to force SanitizerMaskCutoffs::getAllScaled to return unsigned.
https://github.com/llvm/llvm-project/pull/124857
More information about the cfe-commits
mailing list