[llvm] [InstCombine] Fold operation into select, when one operand is zext of select's condition (PR #166816)

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 00:14:20 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())))) {
----------------
spaits wrote:

Couldn't we use `m_ZExtOrTruncOrSelf` here. It would work for all `i1` cases (i don't know how useful that is).

https://github.com/llvm/llvm-project/pull/166816


More information about the llvm-commits mailing list