Skip to content

Commit 56a9d30

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent 7dfcced commit 56a9d30

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ using namespace llvm;
3131

3232
static cl::opt<int>
3333
HotPercentileCutoff("lower-allow-check-percentile-cutoff-hot",
34-
cl::desc("Hot percentile cutoff."));
34+
cl::desc("Hot percentile cutoff."),
35+
cl::init(0));
3536

3637
static cl::opt<float>
3738
RandomRate("lower-allow-check-random-rate",
@@ -84,15 +85,12 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI,
8485
};
8586

8687
auto GetCutoff = [&](const IntrinsicInst *II) -> unsigned {
87-
if (HotPercentileCutoff.getNumOccurrences())
88-
return HotPercentileCutoff;
89-
else if (II->getIntrinsicID() == Intrinsic::allow_ubsan_check) {
88+
if (II->getIntrinsicID() == Intrinsic::allow_ubsan_check) {
9089
auto *Kind = cast<ConstantInt>(II->getArgOperand(0));
9190
if (Kind->getZExtValue() < cutoffs.size())
9291
return cutoffs[Kind->getZExtValue()];
9392
}
94-
95-
return 0;
93+
return HotPercentileCutoff;
9694
};
9795

9896
auto ShouldRemoveHot = [&](const BasicBlock &BB, unsigned int cutoff) {

0 commit comments

Comments
 (0)