[llvm] [InstCombine] Set !prof metadata on Selects identified by add.ll test (PR #158743)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 18:20:35 PDT 2025
================
@@ -878,13 +879,18 @@ Instruction *InstCombinerImpl::foldAddWithConstant(BinaryOperator &Add) {
return BinaryOperator::CreateAdd(Builder.CreateNot(Y), X);
// zext(bool) + C -> bool ? C + 1 : C
+ SelectInst *SI = nullptr;
if (match(Op0, m_ZExt(m_Value(X))) &&
X->getType()->getScalarSizeInBits() == 1)
- return SelectInst::Create(X, InstCombiner::AddOne(Op1C), Op1);
+ SI = SelectInst::Create(X, InstCombiner::AddOne(Op1C), Op1);
// sext(bool) + C -> bool ? C - 1 : C
if (match(Op0, m_SExt(m_Value(X))) &&
----------------
mtrofin wrote:
do you want to include in the test that `!SI && ...`?
https://github.com/llvm/llvm-project/pull/158743
More information about the llvm-commits
mailing list