================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to