[llvm] [InstCombine] Preserve profile branch weights when folding logical booleans (PR #161293)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 30 00:54:20 PDT 2025
================
@@ -1722,16 +1722,19 @@ class IRBuilderBase {
return Insert(BinOp, Name);
}
- Value *CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name = "") {
+ Value *CreateLogicalAnd(Value *Cond1, Value *Cond2, const Twine &Name = "",
+ Instruction *MDFrom = nullptr) {
assert(Cond2->getType()->isIntOrIntVectorTy(1));
return CreateSelect(Cond1, Cond2,
- ConstantInt::getNullValue(Cond2->getType()), Name);
+ ConstantInt::getNullValue(Cond2->getType()), Name,
+ MDFrom);
----------------
nikic wrote:
Only prof and unpredicatable metadata get copied from MDFrom.
https://github.com/llvm/llvm-project/pull/161293
More information about the llvm-commits
mailing list