[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:42:32 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:
```
/usr/local/google/home/thurston/llvm-projectJ/clang/lib/CodeGen/BackendUtil.cpp:813:22: error: no viable overloaded '='
813 | Opts.cutoffs = *ScaledCutoffs;
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:751:7: note: candidate function not viable: no known conversion from 'vector<int, allocator<int>>' to 'const vector<unsigned int, allocator<unsigned int>>' for 1st argument
751 | operator=(const vector& __x);
```
https://github.com/llvm/llvm-project/pull/124857
More information about the cfe-commits
mailing list