[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 26 15:42:19 PST 2025


================
@@ -81,21 +83,20 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI,
     return *Rng;
   };
 
-  auto ShouldRemoveHot = [&](const BasicBlock &BB) {
-    return HotPercentileCutoff.getNumOccurrences() && PSI &&
-           PSI->isHotCountNthPercentile(
-               HotPercentileCutoff, BFI.getBlockProfileCount(&BB).value_or(0));
+  auto ShouldRemoveHot = [&](const BasicBlock &BB, const unsigned int &cutoff) {
+    return PSI && PSI->isHotCountNthPercentile(
+                      cutoff, BFI.getBlockProfileCount(&BB).value_or(0));
   };
 
   auto ShouldRemoveRandom = [&]() {
     return RandomRate.getNumOccurrences() &&
            !std::bernoulli_distribution(RandomRate)(GetRng());
   };
 
-  auto ShouldRemove = [&](const BasicBlock &BB) {
-    return ShouldRemoveRandom() || ShouldRemoveHot(BB);
-  };
-
+  // In some cases, EmitCheck was called with multiple checks (e.g.,
----------------
vitalybuka wrote:

We know nothing about multiple Kind here.
This comment is irrelevant.

https://github.com/llvm/llvm-project/pull/124211


More information about the llvm-commits mailing list