From 56a9d30a8640e6f6571ddb47f5ae5b6efde13dcb Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Wed, 25 Jun 2025 14:31:08 -0700 Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?= =?UTF-8?q?itial=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- .../Transforms/Instrumentation/LowerAllowCheckPass.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp index 10e908ef73ce5..e15fb186352bd 100644 --- a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp +++ b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp @@ -31,7 +31,8 @@ using namespace llvm; static cl::opt HotPercentileCutoff("lower-allow-check-percentile-cutoff-hot", - cl::desc("Hot percentile cutoff.")); + cl::desc("Hot percentile cutoff."), + cl::init(0)); static cl::opt RandomRate("lower-allow-check-random-rate", @@ -84,15 +85,12 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, }; auto GetCutoff = [&](const IntrinsicInst *II) -> unsigned { - if (HotPercentileCutoff.getNumOccurrences()) - return HotPercentileCutoff; - else if (II->getIntrinsicID() == Intrinsic::allow_ubsan_check) { + if (II->getIntrinsicID() == Intrinsic::allow_ubsan_check) { auto *Kind = cast(II->getArgOperand(0)); if (Kind->getZExtValue() < cutoffs.size()) return cutoffs[Kind->getZExtValue()]; } - - return 0; + return HotPercentileCutoff; }; auto ShouldRemoveHot = [&](const BasicBlock &BB, unsigned int cutoff) { From bf4b447f9422bff371b3b1ad809418cb3bb753e7 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Wed, 25 Jun 2025 14:32:13 -0700 Subject: [PATCH 2/2] fmt Created using spr 1.3.4 --- llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp index e15fb186352bd..534b9e99ee042 100644 --- a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp +++ b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp @@ -31,8 +31,7 @@ using namespace llvm; static cl::opt HotPercentileCutoff("lower-allow-check-percentile-cutoff-hot", - cl::desc("Hot percentile cutoff."), - cl::init(0)); + cl::desc("Hot percentile cutoff."), cl::init(0)); static cl::opt RandomRate("lower-allow-check-random-rate",