[llvm] [InstCombine] Fix ProfCheck for optimizing bitreverse (PR #227189)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 22:06:11 PDT 2026
================
@@ -2556,8 +2557,15 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
X->getType()->isIntOrIntVectorTy(1)) {
Type *Ty = II->getType();
APInt SignBit = APInt::getSignMask(Ty->getScalarSizeInBits());
- return SelectInst::Create(X, ConstantInt::get(Ty, SignBit),
- ConstantInt::getNullValue(Ty));
+ SelectInst *SI = SelectInst::Create(X, ConstantInt::get(Ty, SignBit),
+ ConstantInt::getNullValue(Ty));
+ // Mark the branch weights explicitly unknown as in the general case we
+ // cannot infer the probability of the condition without additional value
+ // profiling.
+ if (std::optional<uint64_t> EC = F.getEntryCount(); !EC || *EC == 0)
----------------
mtrofin wrote:
don't we have a set...IfProfiled?
https://github.com/llvm/llvm-project/pull/227189
More information about the llvm-commits
mailing list