diff options
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 97bc063..1c92ea4 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -805,17 +805,21 @@ static void addSanitizers(const Triple &TargetTriple, // SanitizeSkipHotCutoffs: doubles with range [0, 1] // Opts.cutoffs: unsigned ints with range [0, 1000000] auto ScaledCutoffs = CodeGenOpts.SanitizeSkipHotCutoffs.getAllScaled(1000000); - + uint64_t AllowRuntimeCheckSkipHotCutoff = + CodeGenOpts.AllowRuntimeCheckSkipHotCutoff.value_or(0.0) * 1000000; // TODO: remove IsRequested() - if (LowerAllowCheckPass::IsRequested() || ScaledCutoffs.has_value()) { + if (LowerAllowCheckPass::IsRequested() || ScaledCutoffs.has_value() || + CodeGenOpts.AllowRuntimeCheckSkipHotCutoff.has_value()) { // We want to call it after inline, which is about OptimizerEarlyEPCallback. PB.registerOptimizerEarlyEPCallback( - [ScaledCutoffs](ModulePassManager &MPM, OptimizationLevel Level, - ThinOrFullLTOPhase Phase) { + [ScaledCutoffs, AllowRuntimeCheckSkipHotCutoff]( + ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase Phase) { LowerAllowCheckPass::Options Opts; // TODO: after removing IsRequested(), make this unconditional if (ScaledCutoffs.has_value()) Opts.cutoffs = ScaledCutoffs.value(); + Opts.runtime_check = AllowRuntimeCheckSkipHotCutoff; MPM.addPass( createModuleToFunctionPassAdaptor(LowerAllowCheckPass(Opts))); }); |