[llvm] [InstCombine] Fold operation into select, when one operand is zext of select's condition (PR #166816)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 06:56:27 PST 2025
================
@@ -1758,6 +1758,9 @@ static Value *simplifyOperationIntoSelectOperand(Instruction &I, SelectInst *SI,
m_Specific(Op), m_Value(V))) &&
isGuaranteedNotToBeUndefOrPoison(V)) {
// Pass
+ } else if (match(Op, m_ZExt(m_Specific(SI->getCondition())))) {
+ V = IsTrueArm ? ConstantInt::get(Op->getType(), 1)
+ : ConstantInt::getNullValue(Op->getType());
----------------
andjo403 wrote:
I think that it can be a separerat PR when/if there is a use for it
https://github.com/llvm/llvm-project/pull/166816
More information about the llvm-commits
mailing list