|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
References
lib/Analysis/AliasSetTracker.cpp 182 !(I->use_empty() && match(I, m_Intrinsic<Intrinsic::invariant_start>()));
494 match(Call, m_Intrinsic<Intrinsic::invariant_start>()))
lib/Analysis/AssumptionCache.cpp 69 if (match(I, m_BitCast(m_Value(Op))) ||
70 match(I, m_PtrToInt(m_Value(Op))) ||
71 match(I, m_Not(m_Value(Op)))) {
82 if (match(Cond, m_ICmp(Pred, m_Value(A), m_Value(B)))) {
90 if (match(V, m_Not(m_Value(A)))) {
98 if (match(V, m_BitwiseLogic(m_Value(A), m_Value(B)))) {
102 } else if (match(V, m_Shift(m_Value(A), m_ConstantInt(C)))) {
178 if (match(&II, m_Intrinsic<Intrinsic::assume>()))
190 assert(match(CI, m_Intrinsic<Intrinsic::assume>()) &&
216 assert(match(cast<CallInst>(VH), m_Intrinsic<Intrinsic::assume>()) &&
287 if (match(&II, m_Intrinsic<Intrinsic::assume>()) &&
lib/Analysis/CmpInstAnalysis.cpp 72 if (!match(RHS, m_APInt(C)))
136 if (LookThruTrunc && match(LHS, m_Trunc(m_Value(X)))) {
lib/Analysis/DemandedBits.cpp 158 } else if (match(II->getOperand(2), m_APInt(SA))) {
185 if (match(UserI->getOperand(1), m_APInt(ShiftAmtC))) {
202 if (match(UserI->getOperand(1), m_APInt(ShiftAmtC))) {
216 if (match(UserI->getOperand(1), m_APInt(ShiftAmtC))) {
lib/Analysis/GuardUtils.cpp 19 return match(U, m_Intrinsic<Intrinsic::experimental_guard>());
30 if (match(&Insn, m_Intrinsic<Intrinsic::experimental_deoptimize>()))
42 if (!match(U, m_Br(m_And(m_Value(Condition), m_Value(WidenableCondition)),
47 return match(WidenableCondition,
lib/Analysis/IVDescriptors.cpp 98 if (match(J, m_c_And(m_Instruction(I), m_APInt(M)))) {
lib/Analysis/InlineCost.cpp 1097 !match(&I, m_FNeg(m_Value())))
lib/Analysis/InstructionPrecedenceTracking.cpp 157 if (match(Insn, m_Intrinsic<Intrinsic::experimental_widenable_condition>()))
lib/Analysis/InstructionSimplify.cpp 102 if (!match(Cond, m_c_BinOp(m_c_ICmp(Pred1, m_Specific(TrueVal),
460 if (match(FCmp, m_Zero()))
465 if (match(TCmp, m_One()))
470 if (match(FCmp, m_One()) && match(TCmp, m_Zero()))
470 if (match(FCmp, m_One()) && match(TCmp, m_Zero()))
582 if (match(Op1, m_Undef()))
586 if (match(Op1, m_Zero()))
597 if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) ||
598 match(Op0, m_Sub(m_Value(Y), m_Specific(Op1))))
603 if (match(Op0, m_Not(m_Specific(Op1))) ||
604 match(Op1, m_Not(m_Specific(Op0))))
610 if ((IsNSW || IsNUW) && match(Op1, m_SignMask()) &&
611 match(Op0, m_Xor(m_Value(Y), m_SignMask())))
615 if (IsNUW && match(Op1, m_AllOnes()))
703 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
703 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
707 if (match(Op1, m_Zero()))
715 if (match(Op0, m_Zero())) {
735 if (MaxRecurse && match(Op0, m_Add(m_Value(X), m_Value(Y)))) { // (X + Y) - Z
757 if (MaxRecurse && match(Op1, m_Add(m_Value(Y), m_Value(Z)))) { // X - (Y + Z)
779 if (MaxRecurse && match(Op1, m_Sub(m_Value(X), m_Value(Y)))) // Z - (X - Y)
790 if (MaxRecurse && match(Op0, m_Trunc(m_Value(X))) &&
791 match(Op1, m_Trunc(m_Value(Y))))
802 if (match(Op0, m_PtrToInt(m_Value(X))) &&
803 match(Op1, m_PtrToInt(m_Value(Y))))
838 if (match(Op1, m_CombineOr(m_Undef(), m_Zero())))
842 if (match(Op1, m_One()))
848 (match(Op0,
850 match(Op1, m_Exact(m_IDiv(m_Value(X), m_Specific(Op0)))))) // Y * (X / Y)
896 if (match(Op1, m_Undef()))
902 if (match(Op1, m_Zero()))
919 if (match(Op0, m_Undef()))
924 if (match(Op0, m_Zero()))
938 if (match(Op1, m_One()) || Ty->isIntOrIntVectorTy(1) ||
939 (match(Op1, m_ZExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)))
973 if (match(X, m_APInt(C)) && !C->isMinSignedValue()) {
983 if (match(Y, m_APInt(C))) {
1020 if (match(Op0, m_c_Mul(m_Value(X), m_Specific(Op1)))) {
1027 if ((IsSigned && match(X, m_SDiv(m_Value(), m_Specific(Op1)))) ||
1028 (!IsSigned && match(X, m_UDiv(m_Value(), m_Specific(Op1)))))
1033 if ((IsSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1034 (!IsSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1039 if (!IsSigned && match(Op0, m_UDiv(m_Value(X), m_ConstantInt(C1))) &&
1040 match(Op1, m_ConstantInt(C2))) {
1076 match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) ||
1078 match(Op0, m_URem(m_Value(), m_Specific(Op1)))))
1084 match(Op0, m_NSWShl(m_Specific(Op1), m_Value()))) ||
1086 match(Op0, m_NUWShl(m_Specific(Op1), m_Value())))))
1141 if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1))
1201 if (match(Op0, m_Zero()))
1208 if (match(Op1, m_Zero()) ||
1209 (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)))
1257 if (match(Op0, m_Undef()))
1279 if (match(Op0, m_Undef()))
1285 match(Op0, m_Exact(m_Shr(m_Value(X), m_Specific(Op1)))))
1289 if (isNUW && match(Op0, m_Negative()))
1312 if (match(Op0, m_NUWShl(m_Value(X), m_Specific(Op1))))
1322 if (match(Op1, m_APInt(ShRAmt)) &&
1323 match(Op0, m_c_Or(m_NUWShl(m_Value(X), m_APInt(ShLAmt)), m_Value(Y))) &&
1350 if (match(Op0, m_AllOnes()))
1355 if (Q.IIQ.UseInstrInfo && match(Op0, m_NSWShl(m_Value(X), m_Specific(Op1))))
1379 if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) ||
1387 if (match(Y, m_Sub(m_Value(A), m_Value(B)))) {
1388 if (match(UnsignedICmp,
1421 if (match(UnsignedICmp,
1437 if (match(UnsignedICmp, m_ICmp(UnsignedPred, m_Value(X), m_Specific(Y))) &&
1440 else if (match(UnsignedICmp,
1487 if (!match(Op0, m_ICmp(Pred0, m_Value(A), m_Value(B))) ||
1488 !match(Op1, m_ICmp(Pred1, m_Specific(A), m_Specific(B))))
1512 if (!match(Op0, m_ICmp(Pred0, m_Value(A), m_Value(B))) ||
1513 !match(Op1, m_ICmp(Pred1, m_Specific(A), m_Specific(B))))
1543 if (!match(Cmp0->getOperand(1), m_APInt(C0)) ||
1544 !match(Cmp1->getOperand(1), m_APInt(C1)))
1576 if (!match(Cmp0->getOperand(1), m_Zero()) ||
1577 !match(Cmp1->getOperand(1), m_Zero()) || P0 != P1)
1595 if (match(Y, m_c_And(m_Specific(X), m_Value())) ||
1596 match(Y, m_c_And(m_PtrToInt(m_Specific(X)), m_Value())))
1603 if (match(X, m_c_And(m_Specific(Y), m_Value())) ||
1604 match(X, m_c_And(m_PtrToInt(m_Specific(Y)), m_Value())))
1616 if (!match(Op0, m_ICmp(Pred0, m_Add(m_Value(V), m_APInt(C0)), m_APInt(C1))))
1619 if (!match(Op1, m_ICmp(Pred1, m_Specific(V), m_Value())))
1689 if (!match(Op0, m_ICmp(Pred0, m_Add(m_Value(V), m_APInt(C0)), m_APInt(C1))))
1692 if (!match(Op1, m_ICmp(Pred1, m_Specific(V), m_Value())))
1841 if (!match(Agg, m_CombineOr(m_Intrinsic<Intrinsic::umul_with_overflow>(),
1845 if (!match(Agg, m_CombineOr(m_Argument<0>(m_Specific(X)),
1863 if (!match(Op0, m_ICmp(Pred, m_Value(X), m_Zero())) ||
1887 if (!match(Op0, m_ICmp(Pred, m_Value(X), m_Zero())) ||
1892 if (!match(NotOp1, m_Not(m_Value(Op1))))
1909 if (match(Op1, m_Undef()))
1917 if (match(Op1, m_Zero()))
1921 if (match(Op1, m_AllOnes()))
1925 if (match(Op0, m_Not(m_Specific(Op1))) ||
1926 match(Op1, m_Not(m_Specific(Op0))))
1930 if (match(Op0, m_c_Or(m_Specific(Op1), m_Value())))
1934 if (match(Op1, m_c_Or(m_Specific(Op0), m_Value())))
1941 if (match(Op1, m_APInt(Mask))) {
1944 if (match(Op0, m_Shl(m_Value(X), m_APInt(ShAmt))) &&
1950 if (match(Op0, m_LShr(m_Value(X), m_APInt(ShAmt))) &&
1964 if (match(Op0, m_Neg(m_Specific(Op1))) ||
1965 match(Op1, m_Neg(m_Specific(Op0)))) {
1977 if (match(Op0, m_Add(m_Specific(Op1), m_AllOnes())) &&
1980 if (match(Op1, m_Add(m_Specific(Op0), m_AllOnes())) &&
2027 if (match(Op1, m_APInt(Mask)) &&
2028 match(Op0, m_c_Or(m_CombineAnd(m_NUWShl(m_Value(X), m_APInt(ShAmt)),
2067 if (match(Op1, m_Undef()) || match(Op1, m_AllOnes()))
2067 if (match(Op1, m_Undef()) || match(Op1, m_AllOnes()))
2072 if (Op0 == Op1 || match(Op1, m_Zero()))
2076 if (match(Op0, m_Not(m_Specific(Op1))) ||
2077 match(Op1, m_Not(m_Specific(Op0))))
2081 if (match(Op0, m_c_And(m_Specific(Op1), m_Value())))
2085 if (match(Op1, m_c_And(m_Specific(Op0), m_Value())))
2089 if (match(Op0, m_Not(m_c_And(m_Specific(Op1), m_Value()))))
2093 if (match(Op1, m_Not(m_c_And(m_Specific(Op1), m_Value()))))
2101 if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&
2102 (match(Op0, m_c_And(m_Specific(A), m_Not(m_Specific(B)))) ||
2103 match(Op0, m_c_And(m_Not(m_Specific(A)), m_Specific(B)))))
2111 if (match(Op0, m_Xor(m_Value(A), m_Value(B))) &&
2112 (match(Op1, m_c_And(m_Specific(A), m_Not(m_Specific(B)))) ||
2113 match(Op1, m_c_And(m_Not(m_Specific(A)), m_Specific(B)))))
2120 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
2121 (match(Op1, m_c_Xor(m_Specific(A), m_Not(m_Specific(B)))) ||
2122 match(Op1, m_c_Xor(m_Not(m_Specific(A)), m_Specific(B)))))
2129 if (match(Op1, m_And(m_Value(A), m_Value(B))) &&
2130 (match(Op0, m_c_Xor(m_Specific(A), m_Not(m_Specific(B)))) ||
2131 match(Op0, m_c_Xor(m_Not(m_Specific(A)), m_Specific(B)))))
2164 if (match(Op0, m_And(m_Value(A), m_APInt(C1))) &&
2165 match(Op1, m_And(m_Value(B), m_APInt(C2)))) {
2173 match(A, m_c_Add(m_Specific(B), m_Value(N)))) {
2180 match(B, m_c_Add(m_Specific(A), m_Value(N)))) {
2209 if (match(Op1, m_Undef()))
2213 if (match(Op1, m_Zero()))
2221 if (match(Op0, m_Not(m_Specific(Op1))) ||
2222 match(Op1, m_Not(m_Specific(Op0))))
2497 if (match(RHS, m_Zero())) {
2514 } else if (match(RHS, m_One())) {
2563 if (!match(RHS, m_Zero()))
2632 if (match(LHS, m_BitCast(m_UIToFP(m_Value(X))))) {
2633 if (Pred == ICmpInst::ICMP_SLT && match(RHS, m_Zero()))
2635 if (Pred == ICmpInst::ICMP_SGT && match(RHS, m_AllOnes()))
2640 if (!match(RHS, m_APInt(C)))
2742 if (LBO && match(LBO, m_c_Or(m_Value(Y), m_Specific(RHS)))) {
2758 if (RBO && match(RBO, m_c_Or(m_Value(Y), m_Specific(LHS)))) {
2776 if (LBO && match(LBO, m_c_And(m_Value(), m_Specific(RHS)))) {
2783 if (RBO && match(RBO, m_c_And(m_Value(), m_Specific(LHS)))) {
2791 if (!CmpInst::isUnsigned(Pred) && match(LHS, m_Neg(m_ZExt(m_Value())))) {
2813 if (LBO && match(LBO, m_URem(m_Value(), m_Specific(RHS)))) {
2843 if (RBO && match(RBO, m_URem(m_Value(), m_Specific(LHS)))) {
2874 if (LBO && (match(LBO, m_LShr(m_Specific(RHS), m_Value())) ||
2875 match(LBO, m_UDiv(m_Specific(RHS), m_Value())))) {
2885 if (RBO && (match(RBO, m_LShr(m_Specific(LHS), m_Value())) ||
2886 match(RBO, m_UDiv(m_Specific(LHS), m_Value())))) {
2901 if (LBO && match(LBO, m_Shl(m_APInt(CI2Val), m_Value())) &&
2987 if (match(LHS, m_SMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) {
2993 } else if (match(RHS, m_SMax(m_Value(A), m_Value(B))) &&
3000 } else if (match(LHS, m_SMin(m_Value(A), m_Value(B))) &&
3008 } else if (match(RHS, m_SMin(m_Value(A), m_Value(B))) &&
3061 if (match(LHS, m_UMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) {
3067 } else if (match(RHS, m_UMax(m_Value(A), m_Value(B))) &&
3074 } else if (match(LHS, m_UMin(m_Value(A), m_Value(B))) &&
3082 } else if (match(RHS, m_UMin(m_Value(A), m_Value(B))) &&
3135 if (match(LHS, m_SMax(m_Value(A), m_Value(B))) &&
3136 match(RHS, m_SMin(m_Value(C), m_Value(D))) &&
3145 } else if (match(LHS, m_SMin(m_Value(A), m_Value(B))) &&
3146 match(RHS, m_SMax(m_Value(C), m_Value(D))) &&
3155 } else if (match(LHS, m_UMax(m_Value(A), m_Value(B))) &&
3156 match(RHS, m_UMin(m_Value(C), m_Value(D))) &&
3165 } else if (match(LHS, m_UMin(m_Value(A), m_Value(B))) &&
3166 match(RHS, m_UMax(m_Value(C), m_Value(D))) &&
3507 if (match(RHS, m_NaN()))
3530 if (match(RHS, m_APFloat(C))) {
3583 if ((match(LHS, m_Intrinsic<Intrinsic::minnum>(m_Value(), m_APFloat(C2))) &&
3585 (match(LHS, m_Intrinsic<Intrinsic::maxnum>(m_Value(), m_APFloat(C2))) &&
3621 if (match(RHS, m_AnyZeroFP())) {
3770 if (FalseVal == X && match(TrueVal, m_And(m_Specific(X), m_APInt(C))) &&
3776 if (TrueVal == X && match(FalseVal, m_And(m_Specific(X), m_APInt(C))) &&
3783 if (FalseVal == X && match(TrueVal, m_Or(m_Specific(X), m_APInt(C))) &&
3789 if (TrueVal == X && match(FalseVal, m_Or(m_Specific(X), m_APInt(C))) &&
3818 if (!match(CondVal, m_ICmp(Pred, m_Value(CmpLHS), m_Value(CmpRHS))))
3821 if (ICmpInst::isEquality(Pred) && match(CmpRHS, m_Zero())) {
3824 if (match(CmpLHS, m_And(m_Value(X), m_APInt(Y))))
3837 if (match(TrueVal, isFsh) && FalseVal == X && CmpLHS == ShAmt &&
3842 if (match(FalseVal, isFsh) && TrueVal == X && CmpLHS == ShAmt &&
3859 if (match(TrueVal, isRotate) && FalseVal == X && CmpLHS == ShAmt &&
3864 if (match(FalseVal, isRotate) && TrueVal == X && CmpLHS == ShAmt &&
3908 if (!match(Cond, m_FCmp(Pred, m_Specific(T), m_Specific(F))) &&
3909 !match(Cond, m_FCmp(Pred, m_Specific(F), m_Specific(T))))
3916 if ((match(T, m_APFloat(C)) && C->isNonZero()) ||
3917 (match(F, m_APFloat(C)) && C->isNonZero())) {
4011 if (match(Ops[1], m_Zero()) && Ops[0]->getType() == GEPTy)
4028 if (match(P, m_Zero()))
4031 if (match(P, m_PtrToInt(m_Value(Temp))))
4039 match(Ops[1], m_Sub(m_Value(P), m_PtrToInt(m_Specific(Ops[0])))))
4045 if (match(Ops[1],
4054 if (match(Ops[1],
4065 [](Value *Idx) { return match(Idx, m_Zero()); })) {
4075 if (match(Ops.back(),
4081 if (match(Ops.back(),
4115 if (match(Val, m_Undef()))
4123 if (match(Agg, m_Undef()))
4168 if (match(Val, m_ExtractElement(m_Specific(Vec), m_Specific(Idx))))
4464 if (match(Op, m_FNeg(m_Value(X))))
4493 if (match(V, m_NaN()))
4510 if (match(Op1, m_NegZeroFP()))
4514 if (match(Op1, m_PosZeroFP()) &&
4526 if (match(Op0, m_FSub(m_AnyZeroFP(), m_Specific(Op1))) ||
4527 match(Op1, m_FSub(m_AnyZeroFP(), m_Specific(Op0))))
4530 if (match(Op0, m_FNeg(m_Specific(Op1))) ||
4531 match(Op1, m_FNeg(m_Specific(Op0))))
4539 (match(Op0, m_FSub(m_Value(X), m_Specific(Op1))) ||
4540 match(Op1, m_FSub(m_Value(X), m_Specific(Op0)))))
4557 if (match(Op1, m_PosZeroFP()))
4561 if (match(Op1, m_NegZeroFP()) &&
4568 if (match(Op0, m_NegZeroFP()) &&
4569 match(Op1, m_FNeg(m_Value(X))))
4574 if (FMF.noSignedZeros() && match(Op0, m_AnyZeroFP()) &&
4575 (match(Op1, m_FSub(m_AnyZeroFP(), m_Value(X))) ||
4576 match(Op1, m_FNeg(m_Value(X)))))
4586 (match(Op1, m_FSub(m_Specific(Op0), m_Value(X))) ||
4587 match(Op0, m_c_FAdd(m_Specific(Op1), m_Value(X)))))
4599 if (match(Op1, m_FPOne()))
4603 if (match(Op0, m_FPOne()))
4607 if (FMF.noNaNs() && FMF.noSignedZeros() && match(Op1, m_AnyZeroFP()))
4611 if (FMF.noNaNs() && FMF.noSignedZeros() && match(Op0, m_AnyZeroFP()))
4619 if (Op0 == Op1 && match(Op0, m_Intrinsic<Intrinsic::sqrt>(m_Value(X))) &&
4666 if (match(Op1, m_FPOne()))
4672 if (FMF.noNaNs() && FMF.noSignedZeros() && match(Op0, m_AnyZeroFP()))
4683 if (FMF.allowReassoc() && match(Op0, m_c_FMul(m_Value(X), m_Specific(Op1))))
4689 if (match(Op0, m_FNegNSZ(m_Specific(Op1))) ||
4690 match(Op1, m_FNegNSZ(m_Specific(Op0))))
4715 if (match(Op0, m_PosZeroFP()))
4718 if (match(Op0, m_NegZeroFP()))
4945 if (match(Op0, m_BSwap(m_Value(X)))) return X;
4949 if (match(Op0, m_BitReverse(m_Value(X)))) return X;
4954 match(Op0, m_Intrinsic<Intrinsic::log>(m_Value(X)))) return X;
4959 match(Op0, m_Intrinsic<Intrinsic::log2>(m_Value(X)))) return X;
4964 match(Op0, m_Intrinsic<Intrinsic::exp>(m_Value(X)))) return X;
4969 (match(Op0, m_Intrinsic<Intrinsic::exp2>(m_Value(X))) ||
4970 match(Op0, m_Intrinsic<Intrinsic::pow>(m_SpecificFP(2.0),
4976 match(Op0, m_Intrinsic<Intrinsic::pow>(m_SpecificFP(10.0),
4991 if (match(Op0, m_SIToFP(m_Value())) || match(Op0, m_UIToFP(m_Value())))
4991 if (match(Op0, m_SIToFP(m_Value())) || match(Op0, m_UIToFP(m_Value())))
5030 if (match(Op0, m_Zero()) || match(Op1, m_Zero()))
5030 if (match(Op0, m_Zero()) || match(Op1, m_Zero()))
5034 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
5034 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
5040 if (match(Op0, m_AllOnes()) || match(Op1, m_AllOnes()))
5040 if (match(Op0, m_AllOnes()) || match(Op1, m_AllOnes()))
5048 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
5048 if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
5052 if (match(Op1, m_Zero()))
5055 if (match(Op0, m_Zero()))
5060 if (match(Op0, m_Zero()) || match(Op1, m_AllOnes()))
5060 if (match(Op0, m_Zero()) || match(Op1, m_AllOnes()))
5065 if (Op0 == Op1 || match(Op0, m_Undef()) || match(Op1, m_Undef()))
5065 if (Op0 == Op1 || match(Op0, m_Undef()) || match(Op1, m_Undef()))
5068 if (match(Op1, m_Zero()))
5094 if (match(Op0, m_Undef()))
5096 if (match(Op1, m_Undef()))
5101 if (match(Op0, m_NaN()))
5103 if (match(Op1, m_NaN()))
5121 if ((match(Op0, m_APFloat(C)) && C->isInfinity() &&
5123 (match(Op1, m_APFloat(C)) && C->isInfinity() &&
5173 if (match(Op0, m_Undef()) && match(Op1, m_Undef()))
5173 if (match(Op0, m_Undef()) && match(Op1, m_Undef()))
5177 if (match(ShAmtArg, m_Undef()))
5181 if (match(ShAmtArg, m_APInt(ShAmtC))) {
lib/Analysis/LazyValueInfo.cpp 849 if (match(&I, m_Intrinsic<Intrinsic::experimental_guard>(m_Value(Cond))))
970 if (match(SI->getFalseValue(), m_Add(m_Specific(A),
978 if (match(SI->getTrueValue(), m_Add(m_Specific(A),
1219 if (LHS != Val && !match(LHS, m_Add(m_Specific(Val), m_ConstantInt()))) {
1226 match(LHS, m_Add(m_Specific(Val), m_ConstantInt(Offset)));
1261 if (WO->getLHS() != Val || !match(WO->getRHS(), m_APInt(C)))
lib/Analysis/ScalarEvolution.cpp 5893 !match(SU->getValue(), m_Select(m_Value(Condition), m_APInt(TrueVal),
7588 if (match(V, m_LShr(m_Value(OutLHS), m_ConstantInt(ShiftAmt))))
7590 else if (match(V, m_AShr(m_Value(OutLHS), m_ConstantInt(ShiftAmt))))
7592 else if (match(V, m_Shl(m_Value(OutLHS), m_ConstantInt(ShiftAmt))))
9442 return match(&I, m_Intrinsic<Intrinsic::experimental_guard>(
10285 if (match(LHSUnknownExpr->getValue(), m_SDiv(m_Value(LL), m_Value(LR)))) {
lib/Analysis/ScalarEvolutionExpander.cpp 835 if (match(W, m_Power2(RHS))) {
2106 if (!match(BB->getTerminator(),
lib/Analysis/ValueTracking.cpp 199 if (match(LHS, m_c_And(m_Not(m_Value(M)), m_Value())) &&
200 match(RHS, m_c_And(m_Specific(M), m_Value())))
202 if (match(RHS, m_c_And(m_Not(m_Value(M)), m_Value())) &&
203 match(LHS, m_c_And(m_Specific(M), m_Value())))
613 if (match(Arg, m_Not(m_Specific(V))) &&
638 if (match(Cmp, m_c_ICmp(Pred, m_V, m_Value(A))) &&
645 } else if (match(Cmp,
658 } else if (match(Cmp, m_c_ICmp(Pred, m_Not(m_c_And(m_V, m_Value(B))),
671 } else if (match(Cmp,
684 } else if (match(Cmp, m_c_ICmp(Pred, m_Not(m_c_Or(m_V, m_Value(B))),
697 } else if (match(Cmp,
713 } else if (match(Cmp, m_c_ICmp(Pred, m_Not(m_c_Xor(m_V, m_Value(B))),
729 } else if (match(Cmp, m_c_ICmp(Pred, m_Shl(m_V, m_ConstantInt(C)),
741 } else if (match(Cmp, m_c_ICmp(Pred, m_Not(m_Shl(m_V, m_ConstantInt(C))),
753 } else if (match(Cmp, m_c_ICmp(Pred, m_Shr(m_V, m_ConstantInt(C)),
763 } else if (match(Cmp, m_c_ICmp(Pred, m_Not(m_Shr(m_V, m_ConstantInt(C))),
776 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
789 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
802 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
815 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
828 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
839 if (match(Cmp, m_ICmp(Pred, m_V, m_Value(A))) &&
1007 match(I, m_c_BinOp(m_Value(X), m_Add(m_Deferred(X), m_Value(Y))))) {
1104 if (match(RHS, m_Neg(m_Specific(LHS))) &&
1519 if (!match(I->getOperand(2), m_APInt(SA)))
1652 if (match(V, m_APInt(C))) {
1747 if (OrZero && match(V, m_Power2OrZero()))
1749 if (match(V, m_Power2()))
1754 if (match(V, m_Shl(m_One(), m_Value())))
1759 if (match(V, m_LShr(m_SignMask(), m_Value())))
1769 if (OrZero && (match(V, m_Shl(m_Value(X), m_Value())) ||
1770 match(V, m_LShr(m_Value(X), m_Value()))))
1780 if (OrZero && match(V, m_And(m_Value(X), m_Value(Y)))) {
1786 if (match(X, m_Neg(m_Specific(Y))) || match(Y, m_Neg(m_Specific(X))))
1786 if (match(X, m_Neg(m_Specific(Y))) || match(Y, m_Neg(m_Specific(X))))
1793 if (match(V, m_Add(m_Value(X), m_Value(Y)))) {
1797 if (match(X, m_And(m_Specific(Y), m_Value())) ||
1798 match(X, m_And(m_Value(), m_Specific(Y))))
1801 if (match(Y, m_And(m_Specific(X), m_Value())) ||
1802 match(Y, m_And(m_Value(), m_Specific(X))))
1826 if (match(V, m_Exact(m_LShr(m_Value(), m_Value()))) ||
1827 match(V, m_Exact(m_UDiv(m_Value(), m_Value())))) {
1929 if (!match(const_cast<User *>(U),
2118 if (match(V, m_Or(m_Value(X), m_Value(Y))))
2127 if (match(V, m_Shl(m_Value(X), m_Value(Y)))) {
2140 else if (match(V, m_Shr(m_Value(X), m_Value(Y)))) {
2164 else if (match(V, m_Exact(m_IDiv(m_Value(X), m_Value())))) {
2168 else if (match(V, m_Add(m_Value(X), m_Value(Y)))) {
2201 else if (match(V, m_Mul(m_Value(X), m_Value(Y)))) {
2228 (match(Induction, m_NSWAdd(m_Specific(PN), m_ConstantInt(X))) ||
2229 match(Induction, m_NUWAdd(m_Specific(PN), m_ConstantInt(X)))) &&
2315 if (!match(RHS, m_APInt(CLow)))
2323 if (!match(RHS2, m_APInt(CHigh)))
2405 if (match(U->getOperand(1), m_APInt(Denominator))) {
2425 if (match(U->getOperand(1), m_APInt(Denominator))) {
2458 if (match(U->getOperand(1), m_APInt(ShAmt))) {
2469 if (match(U->getOperand(1), m_APInt(ShAmt))) {
2914 if (match(Op, m_FAdd(m_Value(), m_PosZeroFP())))
3913 if (match(Inst->getOperand(1), m_APInt(V)))
3921 if (!match(Inst->getOperand(1), m_APInt(Denominator)))
3931 if (match(Inst->getOperand(0), m_APInt(Numerator)))
4503 if (CmpRHS != TrueVal || !match(CmpRHS, m_APFloat(FC1)) || !FC1->isFinite())
4512 if (match(FalseVal,
4522 if (match(FalseVal,
4546 if (CmpRHS == TrueVal && match(CmpRHS, m_APInt(C1))) {
4549 if (match(FalseVal, m_SMin(m_Specific(CmpLHS), m_APInt(C2))) &&
4554 if (match(FalseVal, m_SMax(m_Specific(CmpLHS), m_APInt(C2))) &&
4559 if (match(FalseVal, m_UMin(m_Specific(CmpLHS), m_APInt(C2))) &&
4564 if (match(FalseVal, m_UMax(m_Specific(CmpLHS), m_APInt(C2))) &&
4637 if ((CmpLHS == A && CmpRHS == C) || (match(C, m_Not(m_Specific(CmpLHS))) &&
4638 match(A, m_Not(m_Specific(CmpRHS)))))
4644 if ((CmpLHS == A && CmpRHS == D) || (match(D, m_Not(m_Specific(CmpLHS))) &&
4645 match(A, m_Not(m_Specific(CmpRHS)))))
4651 if ((CmpLHS == B && CmpRHS == C) || (match(C, m_Not(m_Specific(CmpLHS))) &&
4652 match(B, m_Not(m_Specific(CmpRHS)))))
4658 if ((CmpLHS == B && CmpRHS == D) || (match(D, m_Not(m_Specific(CmpLHS))) &&
4659 match(B, m_Not(m_Specific(CmpRHS)))))
4690 if (match(TrueVal, m_Zero()) &&
4691 match(FalseVal, m_NSWSub(m_Specific(CmpLHS), m_Specific(CmpRHS))))
4697 if (match(FalseVal, m_Zero()) &&
4698 match(TrueVal, m_NSWSub(m_Specific(CmpLHS), m_Specific(CmpRHS))))
4702 if (!match(CmpRHS, m_APInt(C1)))
4707 if ((CmpLHS == TrueVal && match(FalseVal, m_APInt(C2))) ||
4708 (CmpLHS == FalseVal && match(TrueVal, m_APInt(C2)))) {
4727 if (match(TrueVal, m_Not(m_Specific(CmpLHS))) &&
4728 match(FalseVal, m_APInt(C2)) && ~(*C1) == *C2)
4733 if (match(FalseVal, m_Not(m_Specific(CmpLHS))) &&
4734 match(TrueVal, m_APInt(C2)) && ~(*C1) == *C2)
4744 if ((!NeedNSW && match(X, m_Sub(m_ZeroInt(), m_Specific(Y)))) ||
4745 (NeedNSW && match(X, m_NSWSub(m_ZeroInt(), m_Specific(Y)))))
4749 if ((!NeedNSW && match(Y, m_Sub(m_ZeroInt(), m_Specific(X)))) ||
4750 (NeedNSW && match(Y, m_NSWSub(m_ZeroInt(), m_Specific(X)))))
4755 return (!NeedNSW && (match(X, m_Sub(m_Value(A), m_Value(B))) &&
4756 match(Y, m_Sub(m_Specific(B), m_Specific(A))))) ||
4757 (NeedNSW && (match(X, m_NSWSub(m_Value(A), m_Value(B))) &&
4758 match(Y, m_NSWSub(m_Specific(B), m_Specific(A)))));
4773 if (match(TrueVal, m_AnyZeroFP()) && !match(FalseVal, m_AnyZeroFP()) &&
4773 if (match(TrueVal, m_AnyZeroFP()) && !match(FalseVal, m_AnyZeroFP()) &&
4776 else if (match(FalseVal, m_AnyZeroFP()) && !match(TrueVal, m_AnyZeroFP()) &&
4776 else if (match(FalseVal, m_AnyZeroFP()) && !match(TrueVal, m_AnyZeroFP()) &&
4781 if (match(CmpLHS, m_AnyZeroFP()))
4783 if (match(CmpRHS, m_AnyZeroFP()))
4888 if (match(TrueVal, MaybeSExtCmpLHS)) {
4893 if (match(CmpLHS, m_Neg(m_Specific(FalseVal))))
4898 if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, ZeroOrAllOnes))
4902 if (Pred == ICmpInst::ICMP_SGE && match(CmpRHS, ZeroOrOne))
4907 if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, ZeroOrOne))
4910 else if (match(FalseVal, MaybeSExtCmpLHS)) {
4915 if (match(CmpLHS, m_Neg(m_Specific(TrueVal))))
4920 if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, ZeroOrAllOnes))
4925 if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, ZeroOrOne))
4989 if (match(CmpI->getOperand(1), m_Constant(CmpConst)) &&
5149 if (match(RHS, m_NSWAdd(m_Specific(LHS), m_APInt(C))))
5158 if (match(RHS, m_NUWAdd(m_Specific(LHS), m_APInt(C))))
5165 if (match(A, m_NUWAdd(m_Value(X), m_APInt(CA))) &&
5166 match(B, m_NUWAdd(m_Specific(X), m_APInt(CB))))
5170 if (match(A, m_Or(m_Value(X), m_APInt(CA))) &&
5171 match(B, m_Or(m_Specific(X), m_APInt(CB)))) {
5330 if ((!LHSIsTrue && match(LHS, m_Or(m_Value(ALHS), m_Value(ARHS)))) ||
5331 (LHSIsTrue && match(LHS, m_And(m_Value(ALHS), m_Value(ARHS))))) {
5403 if (!match(PredBB->getTerminator(), m_Br(m_Value(PredCond), TrueBB, FalseBB)))
5424 if (match(BO.getOperand(1), m_APInt(C)) && !C->isNullValue()) {
5444 if (match(BO.getOperand(1), m_APInt(C)))
5450 if (match(BO.getOperand(1), m_APInt(C)))
5456 if (match(BO.getOperand(1), m_APInt(C)) && C->ult(Width)) {
5460 } else if (match(BO.getOperand(0), m_APInt(C))) {
5477 if (match(BO.getOperand(1), m_APInt(C)) && C->ult(Width)) {
5480 } else if (match(BO.getOperand(0), m_APInt(C))) {
5491 if (match(BO.getOperand(0), m_APInt(C))) {
5513 if (match(BO.getOperand(1), m_APInt(C))) {
5531 } else if (match(BO.getOperand(0), m_APInt(C))) {
5545 if (match(BO.getOperand(1), m_APInt(C)) && !C->isNullValue()) {
5548 } else if (match(BO.getOperand(0), m_APInt(C))) {
5555 if (match(BO.getOperand(1), m_APInt(C))) {
5563 if (match(BO.getOperand(1), m_APInt(C)))
5580 if (match(II.getOperand(0), m_APInt(C)) ||
5581 match(II.getOperand(1), m_APInt(C)))
5585 if (match(II.getOperand(0), m_APInt(C)) ||
5586 match(II.getOperand(1), m_APInt(C))) {
5600 if (match(II.getOperand(0), m_APInt(C)))
5603 else if (match(II.getOperand(1), m_APInt(C)))
5607 if (match(II.getOperand(0), m_APInt(C))) {
5617 } else if (match(II.getOperand(1), m_APInt(C))) {
5648 if (match(RHS, m_Neg(m_Specific(LHS))) &&
5664 if (!match(LHS, m_APInt(C)) && !match(RHS, m_APInt(C)))
5664 if (!match(LHS, m_APInt(C)) && !match(RHS, m_APInt(C)))
5691 if (match(V, m_APInt(C)))
lib/Analysis/VectorUtils.cpp 134 while (LastOperand > 1 && match(Gep->getOperand(LastOperand), m_Zero())) {
300 if (match(V, m_Add(m_Value(Val), m_Constant(C))))
320 if (match(V, m_ShuffleVector(m_InsertElement(m_Value(), m_Value(Splat),
345 if (match(V, m_ShuffleVector(m_Value(), m_Value(), m_Constant(Mask))))
354 if (match(V, m_BinOp(m_Value(X), m_Value(Y))))
358 if (match(V, m_Select(m_Value(X), m_Value(Y), m_Value(Z))))
lib/CodeGen/CodeGenPrepare.cpp 1238 if (Pred == ICmpInst::ICMP_EQ && match(B, m_AllOnes()))
1240 else if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt()))
1248 if (match(U, m_Add(m_Specific(A), m_Specific(B)))) {
1262 if (!match(Cmp, m_UAddWithOverflow(m_Value(A), m_Value(B), m_BinOp(Add))))
1298 if (Pred == ICmpInst::ICMP_EQ && match(B, m_ZeroInt())) {
1303 if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt())) {
1317 if (match(U, m_Sub(m_Specific(A), m_Specific(B)))) {
1324 if (match(U, m_Add(m_Specific(A), m_APInt(AddC))) &&
1325 match(B, m_APInt(CmpC)) && *AddC == -(*CmpC)) {
1720 if (match(CountZeros->getOperand(1), m_One()))
3515 match(ScaleReg, m_Add(m_Value(AddLHS), m_ConstantInt(CI)))) {
5915 if (!match(Shift->getOperand(1),
6700 if (!match(SI.getValueOperand(),
7197 if (!match(BB.getTerminator(), m_Br(m_OneUse(m_BinOp(LogicOp)), TBB, FBB)))
7206 if (match(LogicOp, m_And(m_OneUse(m_Value(Cond1)),
7209 else if (match(LogicOp, m_Or(m_OneUse(m_Value(Cond1)),
7215 if (!match(Cond1, m_CombineOr(m_Cmp(), m_BinOp())) ||
7216 !match(Cond2, m_CombineOr(m_Cmp(), m_BinOp())) )
lib/CodeGen/SelectionDAG/FastISel.cpp 1802 if (match(I, m_FNeg(m_Value(X))))
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 2081 if (match(Cond, m_OneUse(m_Not(m_Value(NotCond)))) &&
lib/IR/ConstantFold.cpp 1015 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV)))
1015 if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV)))
1029 if (match(C2, m_Zero()) || match(C2, m_One()))
1029 if (match(C2, m_Zero()) || match(C2, m_One()))
1036 if (match(C2, m_Undef()))
1039 if (match(C2, m_Zero()))
1052 if (match(C2, m_Zero()))
1061 if (match(C2, m_Zero()))
1071 if (match(C2, m_Zero()))
lib/IR/Constants.cpp 262 return PatternMatch::match(ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_EQ,
lib/Target/AArch64/AArch64ISelLowering.cpp 8639 if (!match(Op1, m_ShuffleVector(m_Value(S1Op1), m_Undef(), m_Constant(M1))) ||
8640 !match(Op2, m_ShuffleVector(m_Value(S2Op1), m_Undef(), m_Constant(M2))))
8670 if (!match(Ext1, m_ZExtOrSExt(m_Value())) ||
8671 !match(Ext2, m_ZExtOrSExt(m_Value())) ||
lib/Target/AMDGPU/AMDGPULowerKernelAttributes.cpp 195 if (match(SI,
lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp 413 if (!Args.empty() && match(Args[0], PatternMatch::m_FPOne())) {
lib/Target/ARM/ARMISelLowering.cpp14739 if (!match(Ext1, m_ZExtOrSExt(m_Value())) ||
14740 !match(Ext2, m_ZExtOrSExt(m_Value())) ||
14791 if (!match(I->getOperand(Op),
lib/Target/ARM/MVETailPredication.cpp 209 if (!match(I, m_ICmp(Pred, m_Instruction(Induction),
218 if (!match(Shuffle, m_ShuffleVector(m_Instruction(Insert), m_Undef(),
224 if (!match(Insert, m_InsertElement(m_Undef(), m_Instruction(BECount),
230 if (!match(BECount, m_Add(m_Value(TripCount), m_AllOnes())))
240 if (!match(Induction, m_Add(m_Instruction(BroadcastSplat),
254 if (!match(BroadcastSplat, m_ShuffleVector(m_Instruction(Insert), m_Undef(),
260 if (!match(Insert, m_InsertElement(m_Undef(), m_Instruction(IV), m_Zero())))
270 if (!match(OnEntry, m_Zero()))
277 if (!match(InLoop, m_Add(m_Instruction(LHS), m_SpecificInt(Lanes))))
lib/Target/Hexagon/HexagonGenExtract.cpp 105 bool Match = match(In, m_And(m_Shl(m_LShr(m_Value(BF), m_ConstantInt(CSR)),
112 Match = match(In, m_And(m_Shl(m_AShr(m_Value(BF), m_ConstantInt(CSR)),
120 Match = match(In, m_And(m_Shl(m_Value(BF), m_ConstantInt(CSL)),
129 Match = match(In, m_And(m_LShr(m_Value(BF), m_ConstantInt(CSR)),
136 Match = match(In, m_And(m_AShr(m_Value(BF), m_ConstantInt(CSR)),
143 Match = match(In, m_Shl(m_LShr(m_Value(BF), m_ConstantInt(CSR)),
150 Match = match(In, m_Shl(m_AShr(m_Value(BF), m_ConstantInt(CSR)),
lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp 683 if (!match(CondV, m_ICmp(P, m_And(m_Value(A), m_Value(B)), m_Value(C))) &&
684 !match(CondV, m_ICmp(P, m_Value(C), m_And(m_Value(A), m_Value(B)))))
693 if (match(A, m_Shl(m_One(), m_Specific(CIV)))) {
696 } else if (match(B, m_Shl(m_One(), m_Specific(CIV)))) {
708 if (match(C, m_Zero()))
730 if (match(ShouldXoredV, m_Xor(m_Value(Y), m_Value(Z)))) {
745 } else if (match(ShouldSameV, m_Zero())) {
755 if (!match(U, m_Xor(m_Specific(SelI), m_Value(R))) &&
756 !match(U, m_Xor(m_Value(R), m_Specific(SelI))))
767 if (!match(T, m_Shl(m_Value(Q), m_Specific(CIV))) &&
768 !match(T, m_Shl(m_ZExt(m_Value(Q)), m_ZExt(m_Specific(CIV)))))
799 if (match(CondV, m_ICmp(P, m_Value(C), m_Zero())) ||
800 match(CondV, m_ICmp(P, m_Zero(), m_Value(C)))) {
806 } else if (match(CondV, m_ICmp(P, m_Value(C), m_One())) ||
807 match(CondV, m_ICmp(P, m_One(), m_Value(C)))) {
817 if (!match(C, m_And(m_Value(X), m_One())) &&
818 !match(C, m_And(m_One(), m_Value(X))))
827 if (!match(TrueV, m_LShr(m_Value(R), m_One())))
830 if (!match(FalseV, m_Xor(m_Specific(TrueV), m_Value(Q))) &&
831 !match(FalseV, m_Xor(m_Value(Q), m_Specific(TrueV))))
838 if (!match(FalseV, m_LShr(m_Value(R), m_One())))
841 if (!match(TrueV, m_Xor(m_Specific(FalseV), m_Value(Q))) &&
842 !match(TrueV, m_Xor(m_Value(Q), m_Specific(FalseV))))
923 if (!match(PV.X, m_Xor(m_Value(X1), m_Value(X2))))
1309 if (!match(&I, m_LShr(m_Value(V), m_One())))
1399 if (match(&*I, m_LShr(m_Value(V), m_One()))) {
lib/Target/WebAssembly/WebAssemblyFastISel.cpp 428 if (match(V, m_Not(m_Value(NotV))) && V->getType()->isIntegerTy(32)) {
lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp 126 if (!match(TermI, m_Br(m_ICmp(Pred, m_Specific(RotAmt), m_ZeroInt()),
181 if (match(V, m_And(m_Value(Op0), m_One()))) {
185 if (match(V, m_And(m_Value(Op0), m_Value(Op1))))
189 if (match(V, m_Or(m_Value(Op0), m_Value(Op1))))
197 if (!match(V, m_LShr(m_Value(Candidate), m_ConstantInt(BitIndex))))
225 if (match(&I, m_c_And(m_OneUse(m_And(m_Value(), m_Value())), m_Value())))
227 else if (match(&I, m_And(m_OneUse(m_Or(m_Value(), m_Value())), m_One())))
287 if ((match(Op0, m_Mul(m_Value(MulOp0), m_SpecificInt(Mask01)))) &&
288 match(Op1, m_SpecificInt(MaskShift))) {
291 if (match(MulOp0, m_And(m_c_Add(m_LShr(m_Value(ShiftOp0), m_SpecificInt(4)),
296 if (match(ShiftOp0,
302 if (match(AndOp0, m_Sub(m_Value(Root), m_Value(SubOp1))) &&
303 match(SubOp1, m_And(m_LShr(m_Specific(Root), m_SpecificInt(1)),
lib/Transforms/InstCombine/InstCombineAddSub.cpp 782 if (match(RHS, m_Add(m_Value(X), m_One())))
785 if (match(LHS, m_Add(m_Value(X), m_One()))) {
787 if (match(RHS, m_Xor(m_Value(Y), m_APInt(C1))))
790 if (match(X, m_Xor(m_Value(Y), m_APInt(C1)))) {
793 if (match(Y, m_Or(m_Value(Z), m_APInt(C2))) && (*C2 == ~(*C1))) {
796 } else if (match(Y, m_And(m_Value(Z), m_APInt(C2))) && (*C1 == *C2)) {
810 if (match(RHS, m_Xor(m_Value(Y), m_APInt(C1))))
816 if (match(LHS, m_Xor(m_Value(Y), m_APInt(C1))))
818 if (match(Y, m_And(m_Value(Z), m_APInt(C2))) && *C1 == (*C2 + 1)) {
831 if (!match(Op1, m_Constant(Op1C)))
838 if (match(Op1, m_APInt(C1)) &&
839 match(Op0, m_OneUse(m_ZExt(m_NUWAdd(m_Value(X), m_APInt(C2))))) &&
849 if (match(Op0, m_OneUse(m_SExt(m_NSWAdd(m_Value(X), m_Constant(NarrowC)))))) {
856 if (match(Op0, m_OneUse(m_ZExt(m_NUWAdd(m_Value(X), m_Constant(NarrowC)))))) {
869 if (!match(Op1, m_Constant(Op1C)))
879 if (match(Op0, m_Sub(m_Constant(Op00C), m_Value(X))))
885 if (match(Op0, m_OneUse(m_Sub(m_Value(X), m_Value(Y)))) &&
886 match(Op1, m_AllOnes()))
890 if (match(Op0, m_ZExt(m_Value(X))) &&
895 if (match(Op0, m_Not(m_Value(X))))
899 if (!match(Op1, m_APInt(C)))
904 if (match(Op0, m_Or(m_Value(), m_APInt(C2))) && *C2 == -*C)
921 if (match(Op0, m_ZExt(m_Xor(m_Value(X), m_APInt(C2)))) &&
931 if (match(Op0, m_SExt(m_Value(X))) &&
938 if (match(Op0, m_AShr(m_Shl(m_Value(X), m_APInt(C2)), m_APInt(C3))) &&
953 if (match(E, m_Mul(m_Value(Op), m_APInt(AI)))) {
957 if (match(E, m_Shl(m_Value(Op), m_APInt(AI)))) {
972 if (match(E, m_SRem(m_Value(Op), m_APInt(AI)))) {
977 if (match(E, m_URem(m_Value(Op), m_APInt(AI)))) {
981 if (match(E, m_And(m_Value(Op), m_APInt(AI))) && (*AI + 1).isPowerOf2()) {
993 if (IsSigned && match(E, m_SDiv(m_Value(Op), m_APInt(AI)))) {
998 if (match(E, m_UDiv(m_Value(Op), m_APInt(AI)))) {
1002 if (match(E, m_LShr(m_Value(Op), m_APInt(AI)))) {
1063 if (!match(&I, m_Add(m_OneUse(m_Shl(m_One(), m_Value(NBits))), m_AllOnes())))
1087 if (match(&I, m_c_Add(m_c_UMin(m_Value(X), m_Not(m_Value(Y))),
1093 if (match(&I, m_Add(m_UMin(m_Value(X), m_APInt(NotC)), m_APInt(C))) &&
1112 if (!match(&I, m_c_BinOp(m_TruncOrSelf(m_CombineAnd(
1127 if (HadTrunc && !match(&I, m_c_BinOp(m_OneUse(m_Value()), m_Value())))
1136 if (!match(
1139 !match(C, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
1148 match(V, m_ZExtOrSelf(m_Value(V)));
1150 match(V, m_SExtOrSelf(m_Value(V)));
1164 if (!match(Select, m_Select(m_ICmp(Pred, m_Specific(X), m_APInt(Thr)),
1174 if (!match(Zero, m_Zero()))
1181 if (!match(SignExtendingValue,
1187 ? !match(SignExtendingValueBaseConstant, m_One())
1188 : !match(SignExtendingValueBaseConstant, m_AllOnes()))
1229 if (match(LHS, m_Xor(m_Value(XorLHS), m_ConstantInt(XorRHS)))) {
1282 if (match(LHS, m_Neg(m_Value(A)))) {
1284 if (match(RHS, m_Neg(m_Value(B))))
1293 if (match(&I, m_c_Add(m_Value(A), m_OneUse(m_SExt(m_Value(B))))) &&
1298 if (match(RHS, m_Neg(m_Value(B))))
1308 if (match(&I, m_c_BinOp(m_Add(m_Value(A), m_One()), m_Not(m_Value(B)))) ||
1309 match(&I, m_BinOp(m_c_Add(m_Not(m_Value(B)), m_Value(A)), m_One())))
1327 match(LHS, m_And(m_Value(X), m_ConstantInt(C2))) &&
1362 if (match(FV, m_Zero()) && match(TV, m_Sub(m_Value(N), m_Specific(A))))
1362 if (match(FV, m_Zero()) && match(TV, m_Sub(m_Value(N), m_Specific(A))))
1366 if (match(TV, m_Zero()) && match(FV, m_Sub(m_Value(N), m_Specific(A))))
1366 if (match(TV, m_Zero()) && match(FV, m_Sub(m_Value(N), m_Specific(A))))
1377 if (match(&I, m_c_BinOp(m_Xor(m_Value(A), m_Value(B)),
1383 if (match(&I, m_c_BinOp(m_Or(m_Value(A), m_Value(B)),
1420 if (!match(&I, m_c_FAdd(m_OneUse(m_c_FMul(m_Value(Y),
1446 if ((match(Op0, m_OneUse(m_FMul(m_Value(X), m_Value(Z)))) &&
1447 match(Op1, m_OneUse(m_c_FMul(m_Value(Y), m_Specific(Z))))) ||
1448 (match(Op0, m_OneUse(m_FMul(m_Value(Z), m_Value(X)))) &&
1449 match(Op1, m_OneUse(m_c_FMul(m_Value(Y), m_Specific(Z))))))
1451 else if (match(Op0, m_OneUse(m_FDiv(m_Value(X), m_Value(Z)))) &&
1452 match(Op1, m_OneUse(m_FDiv(m_Value(Y), m_Specific(Z)))))
1468 if (match(XY, m_APFloat(C)) && !C->isNormal())
1492 if (match(&I, m_c_FAdd(m_FNeg(m_Value(X)), m_Value(Y))))
1498 if (match(&I, m_c_FAdd(m_OneUse(m_c_FMul(m_FNeg(m_Value(X)), m_Value(Y))),
1505 if (match(&I, m_c_FAdd(m_OneUse(m_FDiv(m_FNeg(m_Value(X)), m_Value(Y))),
1507 match(&I, m_c_FAdd(m_OneUse(m_FDiv(m_Value(X), m_FNeg(m_Value(Y)))),
1707 if (match(Op0, m_AllOnes()))
1712 if (match(Op0, m_Not(m_Value(X))) && match(Op1, m_Not(m_Value(Y))))
1712 if (match(Op0, m_Not(m_Value(X))) && match(Op1, m_Not(m_Value(Y))))
1716 if (match(Op0, m_OneUse(m_Add(m_Value(X), m_AllOnes()))))
1720 if (match(Op1, m_OneUse(m_Add(m_Value(X), m_One()))))
1724 if (match(Op1, m_OneUse(m_Not(m_Value(X))))) {
1730 bool IsNegate = match(C, m_ZeroInt());
1732 if (match(Op1, m_ZExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
1739 if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
1748 if (match(Op1, m_Not(m_Value(X))))
1764 if (match(Op1, m_Sub(m_Constant(C2), m_Value(X))))
1768 if (match(Op1, m_Add(m_Value(X), m_Constant(C2))))
1773 if (match(Op0, m_APInt(Op0C))) {
1777 match(Op1, m_TruncOrSelf(m_Value(Op1Wide)));
1786 match(Op1Wide, m_LShr(m_Value(X), m_APInt(ShAmt))) &&
1798 match(Op1Wide, m_AShr(m_Value(X), m_APInt(ShAmt))) &&
1834 if (match(Op1, m_c_Add(m_Specific(Op0), m_Value(Y))))
1838 if (match(Op0, m_Sub(m_Specific(Op1), m_Value(Y))))
1845 if (match(Op1, m_And(m_Value(A), m_Value(B))) &&
1846 match(Op0, m_c_Or(m_Specific(A), m_Specific(B))))
1853 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1854 match(Op1, m_c_Or(m_Specific(A), m_Specific(B))) &&
1862 if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&
1863 match(Op0, m_c_Or(m_Specific(A), m_Specific(B))))
1870 if (match(Op0, m_Xor(m_Value(A), m_Value(B))) &&
1871 match(Op1, m_c_Or(m_Specific(A), m_Specific(B))) &&
1879 if (match(Op0, m_OneUse(m_c_Or(m_Value(Y), m_Specific(Op1)))))
1889 if (match(Op1, m_Sub(m_Value(Y), m_Value(Z))))
1894 if (match(Op1, m_c_And(m_Value(Y), m_Specific(Op0))))
1901 if (match(Op0, m_Zero()) && match(Op1, m_SDiv(m_Value(X), m_APInt(DivC))) &&
1901 if (match(Op0, m_Zero()) && match(Op1, m_SDiv(m_Value(X), m_APInt(DivC))) &&
1910 if (match(Op1, m_Shl(m_Value(X), m_Value(Y))) && match(Op0, m_Zero()))
1910 if (match(Op1, m_Shl(m_Value(X), m_Value(Y))) && match(Op0, m_Zero()))
1917 if (match(Op1, m_SExt(m_Value(Y))) &&
1928 if (match(Op1, m_c_Mul(m_Value(A), m_Neg(m_Value(B)))))
1934 if (match(Op1, m_Mul(m_Value(A), m_Constant(C))) && !isa<ConstantExpr>(C)) {
1955 match(NotA, m_Not(m_Value(A))) && (NotA == LHS || NotA == RHS)) {
1976 if (match(Op0, m_PtrToInt(m_Value(LHSOp))) &&
1977 match(Op1, m_PtrToInt(m_Value(RHSOp))))
1982 if (match(Op0, m_Trunc(m_PtrToInt(m_Value(LHSOp)))) &&
1983 match(Op1, m_Trunc(m_PtrToInt(m_Value(RHSOp)))))
1995 if (match(Op1, m_AShr(m_Value(A), m_APInt(ShAmt))) &&
1997 match(Op0, m_OneUse(m_c_Xor(m_Specific(A), m_Specific(Op1))))) {
2039 if (match(&I, m_FNeg(m_OneUse(m_FMul(m_Value(X), m_Constant(C))))))
2042 if (match(&I, m_FNeg(m_OneUse(m_FDiv(m_Value(X), m_Constant(C))))))
2045 if (match(&I, m_FNeg(m_OneUse(m_FDiv(m_Constant(C), m_Value(X))))))
2054 if (!match(&I, m_FNeg(m_Value(FNeg))))
2058 if (match(FNeg, m_OneUse(m_FMul(m_Value(X), m_Value(Y)))))
2061 if (match(FNeg, m_OneUse(m_FDiv(m_Value(X), m_Value(Y)))))
2081 match(Op, m_OneUse(m_FSub(m_Value(X), m_Value(Y)))))
2102 if (I.hasNoSignedZeros() && match(Op0, m_PosZeroFP()))
2121 if (match(Op1, m_OneUse(m_FSub(m_Value(X), m_Value(Y))))) {
2135 if (match(Op1, m_Constant(C)) && !isa<ConstantExpr>(Op1))
2139 if (match(Op1, m_FNeg(m_Value(Y))))
2145 if (match(Op1, m_OneUse(m_FPTrunc(m_FNeg(m_Value(Y))))))
2149 if (match(Op1, m_OneUse(m_FPExt(m_FNeg(m_Value(Y))))))
2155 if (match(Op1, m_OneUse(m_c_FMul(m_FNeg(m_Value(X)), m_Value(Y))))) {
2161 if (match(Op1, m_OneUse(m_FDiv(m_FNeg(m_Value(X)), m_Value(Y)))) ||
2162 match(Op1, m_OneUse(m_FDiv(m_Value(X), m_FNeg(m_Value(Y)))))) {
2173 if (match(Op0, m_FSub(m_Specific(Op1), m_Value(X))))
2178 if (match(Op1, m_c_FAdd(m_Specific(Op0), m_Value(X))))
2182 if (match(Op0, m_FMul(m_Specific(Op1), m_Constant(C)))) {
2187 if (match(Op1, m_FMul(m_Specific(Op0), m_Constant(C)))) {
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp 90 if (!match(OldLHS, m_BSwap(m_Value(NewLHS))))
96 if (match(OldRHS, m_BSwap(m_Value(NewRHS)))) {
101 } else if (match(OldRHS, m_APInt(C))) {
335 if (!match(L1, m_And(m_Value(L11), m_Value(L12)))) {
342 if (!match(L2, m_And(m_Value(L21), m_Value(L22)))) {
370 if (!match(R1, m_And(m_Value(R11), m_Value(R12)))) {
396 if (!match(R2, m_And(m_Value(R11), m_Value(R12)))) {
812 if (!match(LHS->getOperand(1), m_APInt(C1)) ||
813 !match(RHS->getOperand(1), m_APInt(C2)))
878 if (match(LHS->getOperand(0), m_And(m_Value(A), m_Value(B))) &&
879 match(RHS->getOperand(0), m_And(m_Value(C), m_Value(D)))) {
938 if (!(match(ICmp,
973 if (match(ICmp, m_ICmp(Pred, m_And(m_Value(X), m_APInt(Mask)), m_Zero())) &&
994 } else if (match(X0, m_Trunc(m_Specific(X1)))) {
1034 if (JoinedByAnd && match(Cmp0, m_ICmp(Pred0, m_Value(X), m_ZeroInt())) &&
1035 match(Cmp1, m_ICmp(Pred1, m_Intrinsic<Intrinsic::ctpop>(m_Specific(X)),
1042 if (!JoinedByAnd && match(Cmp0, m_ICmp(Pred0, m_Value(X), m_ZeroInt())) &&
1043 match(Cmp1, m_ICmp(Pred1, m_Intrinsic<Intrinsic::ctpop>(m_Specific(X)),
1060 if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(ZeroCmpOp), m_Zero())) ||
1071 if (match(UnsignedICmp,
1073 match(ZeroCmpOp, m_c_Add(m_Specific(A), m_Value(B))) &&
1107 if (!match(ZeroCmpOp, m_Sub(m_Value(Base), m_Value(Offset))))
1110 if (!match(UnsignedICmp,
1226 if (match(RHS0, m_Trunc(m_Value(V))) &&
1227 match(LHS0, m_And(m_Specific(V), m_ConstantInt(AndC)))) {
1230 } else if (match(LHS0, m_Trunc(m_Value(V))) &&
1231 match(RHS0, m_And(m_Specific(V), m_ConstantInt(AndC)))) {
1399 if (match(LHS1, m_PosZeroFP()) && match(RHS1, m_PosZeroFP()))
1399 if (match(LHS1, m_PosZeroFP()) && match(RHS1, m_PosZeroFP()))
1423 if (match(Op1, m_FCmp(Pred, m_Value(), m_AnyZeroFP())))
1430 if (!match(Op0, m_FCmp(Pred, m_Value(X), m_AnyZeroFP())) || Pred != NanPred ||
1431 !match(Op1, m_BinOp(BO1)) || BO1->getOpcode() != Opcode)
1436 if (!match(BO10, m_FCmp(Pred, m_Value(Y), m_AnyZeroFP())) ||
1440 if (!match(BO10, m_FCmp(Pred, m_Value(Y), m_AnyZeroFP())) ||
1468 if (match(I.getOperand(0), m_OneUse(m_Not(m_Value(A)))) &&
1469 match(I.getOperand(1), m_OneUse(m_Not(m_Value(B)))) &&
1511 if (match(Cast, m_OneUse(m_ZExt(m_Value(X))))) {
1521 if (match(Cast, m_OneUse(m_SExt(m_Value(X))))) {
1611 if (match(&I, m_BinOp(m_Or(m_Value(A), m_Value(B)),
1620 if (match(&I, m_BinOp(m_c_Or(m_Value(A), m_Not(m_Value(B))),
1638 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
1639 match(Op1, m_Not(m_c_Or(m_Specific(A), m_Specific(B)))))
1646 if (match(Op0, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&
1647 match(Op1, m_c_And(m_Not(m_Specific(A)), m_Specific(B))))
1689 if (!match(Op0, m_OneUse(m_Add(m_Specific(Op1), m_Constant(C)))) &&
1690 !match(Op0, m_OneUse(m_Mul(m_Specific(Op1), m_Constant(C)))) &&
1691 !match(Op0, m_OneUse(m_LShr(m_Specific(Op1), m_Constant(C)))) &&
1692 !match(Op0, m_OneUse(m_Shl(m_Specific(Op1), m_Constant(C)))) &&
1693 !match(Op0, m_OneUse(m_Sub(m_Constant(C), m_Specific(Op1)))))
1697 if (!match(Op1, m_ZExt(m_Value(X))) || Op1->hasNUsesOrMore(3))
1752 if (match(Op1, m_APInt(C))) {
1754 if (match(Op0, m_OneUse(m_LogicalShift(m_One(), m_Value(X)))) &&
1763 if (match(Op0, m_OneUse(m_Xor(m_Value(X), m_APInt(XorC))))) {
1772 if (match(Op0, m_OneUse(m_Or(m_Value(X), m_APInt(OrC))))) {
1788 if (match(Op0, m_OneUse(m_Xor(m_Value(X), m_Value(Y)))) ||
1789 match(Op0, m_OneUse(m_Or(m_Value(X), m_Value(Y))))) {
1828 if (match(Op0I, m_OneUse(m_c_BinOp(m_OneUse(m_ZExt(m_Value(X))),
1854 if (match(Op0, m_Trunc(m_And(m_Value(X), m_ConstantInt(YC))))) {
1879 if (match(Op1, m_OneUse(m_c_Xor(m_Specific(Op0), m_Value(B)))))
1882 if (match(Op0, m_OneUse(m_c_Xor(m_Specific(Op1), m_Value(B)))))
1886 if (match(Op0, m_Xor(m_Value(A), m_Value(B))))
1887 if (match(Op1, m_Xor(m_Xor(m_Specific(B), m_Value(C)), m_Specific(A))))
1892 if (match(Op0, m_Xor(m_Xor(m_Value(A), m_Value(C)), m_Value(B))))
1893 if (match(Op1, m_Xor(m_Specific(B), m_Specific(A))))
1901 if (match(Op1, m_c_Xor(m_Not(m_Value(A)), m_Value(B))) &&
1902 match(Op0, m_c_Or(m_Specific(A), m_Specific(B))))
1909 if (match(Op0, m_c_Xor(m_Not(m_Value(A)), m_Value(B))) &&
1910 match(Op1, m_c_Or(m_Specific(A), m_Specific(B))))
1924 if (LHS && match(Op1, m_OneUse(m_And(m_Value(X), m_Value(Y))))) {
1932 if (RHS && match(Op0, m_OneUse(m_And(m_Value(X), m_Value(Y))))) {
1955 if (match(Op0, m_OneUse(m_SExt(m_Value(A)))) &&
1958 if (match(Op1, m_OneUse(m_SExt(m_Value(A)))) &&
1967 if (match(&I, m_c_And(m_OneUse(m_AShr(m_NSWSub(m_Value(Y), m_Value(X)),
1991 bool OrOfOrs = match(Op0, m_Or(m_Value(), m_Value())) ||
1992 match(Op1, m_Or(m_Value(), m_Value()));
1995 bool OrOfShifts = match(Op0, m_LogicalShift(m_Value(), m_Value())) &&
1996 match(Op1, m_LogicalShift(m_Value(), m_Value()));
1999 bool OrOfAnds = match(Op0, m_And(m_Value(), m_Value())) &&
2000 match(Op1, m_And(m_Value(), m_Value()));
2008 bool OrOfAndAndSh = (match(Op0, m_LogicalShift(m_Value(), m_Value())) &&
2009 match(Op1, m_And(m_Value(), m_Value()))) ||
2010 (match(Op0, m_And(m_Value(), m_Value())) &&
2011 match(Op1, m_LogicalShift(m_Value(), m_Value())));
2038 if (!match(Or.getOperand(0), m_BinOp(Or0)) ||
2039 !match(Or.getOperand(1), m_BinOp(Or1)))
2043 if (!match(Or0, m_OneUse(m_LogicalShift(m_Value(ShVal), m_Value(ShAmt0)))) ||
2044 !match(Or1, m_OneUse(m_LogicalShift(m_Specific(ShVal), m_Value(ShAmt1)))))
2059 if (match(L, m_And(m_Value(X), m_SpecificInt(Mask))) &&
2060 match(R, m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask))))
2065 if (match(L, m_ZExt(m_And(m_Value(X), m_SpecificInt(Mask)))) &&
2066 match(R, m_And(m_Neg(m_ZExt(m_And(m_Specific(X), m_SpecificInt(Mask)))),
2099 if (!((match(EltC1, m_Zero()) && match(EltC2, m_AllOnes())) ||
2099 if (!((match(EltC1, m_Zero()) && match(EltC2, m_AllOnes())) ||
2100 (match(EltC2, m_Zero()) && match(EltC1, m_AllOnes()))))
2100 (match(EltC2, m_Zero()) && match(EltC1, m_AllOnes()))))
2121 if (match(A, m_Not(m_Specific(B)))) {
2130 if (match(A, m_Constant(AConst)) && match(B, m_Constant(BConst)))
2130 if (match(A, m_Constant(AConst)) && match(B, m_Constant(BConst)))
2138 if (match(A, m_SExt(m_Value(Cond))) &&
2140 match(B, m_OneUse(m_Not(m_Value(NotB))))) {
2142 if (match(NotB, m_SExt(m_Specific(Cond))))
2154 if (match(A, (m_Xor(m_SExt(m_Value(Cond)), m_Constant(AConst)))) &&
2155 match(B, (m_Xor(m_SExt(m_Specific(Cond)), m_Constant(BConst)))) &&
2222 if (match(LAdd, m_Add(m_Value(LAddOpnd), m_ConstantInt(LAddC))) &&
2223 match(RAdd, m_Add(m_Value(RAddOpnd), m_ConstantInt(RAddC))) &&
2339 if (match(LHS0, m_Add(m_Specific(RHS0), m_ConstantInt(AddC))))
2486 if (match(&I, m_c_Or(m_OneUse(m_Xor(m_Value(X), m_APInt(CV))), m_Value(Y))) &&
2497 if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
2498 match(Op1, m_And(m_Value(B), m_Value(D)))) {
2506 if (match(A, m_Or(m_Value(V1), m_Value(V2))) &&
2514 if (match(B, m_Or(m_Value(V1), m_Value(V2))) &&
2525 if (match(A, m_Or(m_Value(V1), m_ConstantInt(C3))) &&
2527 match(B, m_Or(m_Specific(V1), m_ConstantInt(C4))) &&
2539 if (match(A, m_c_Or(m_Value(X), m_Specific(B))))
2542 if (match(B, m_c_Or(m_Specific(A), m_Value(X))))
2546 if (match(A, m_c_Xor(m_Value(X), m_Specific(B))))
2549 if (match(B, m_c_Xor(m_Specific(A), m_Value(X))))
2579 if (match(Op0, m_Xor(m_Value(A), m_Value(B))))
2580 if (match(Op1, m_Xor(m_Xor(m_Specific(B), m_Value(C)), m_Specific(A))))
2584 if (match(Op0, m_Xor(m_Xor(m_Value(A), m_Value(C)), m_Value(B))))
2585 if (match(Op1, m_Xor(m_Specific(B), m_Specific(A))))
2589 if (match(Op0, m_And(m_Or(m_Specific(Op1), m_Value(C)), m_Value(A))))
2597 if (match(Op0, m_Xor(m_Value(), m_Value()))) {
2605 if (match(Op1, m_Xor(m_Value(A), m_Value(B)))) {
2609 if (match(Op0, m_And(m_Specific(A), m_Specific(B))) ||
2610 match(Op0, m_And(m_Specific(B), m_Specific(A))))
2613 if (Op1->hasOneUse() && match(A, m_Not(m_Specific(Op0)))) {
2617 if (Op1->hasOneUse() && match(B, m_Not(m_Specific(Op0)))) {
2625 if (match(Op1, m_Not(m_Value(A))))
2649 if (LHS && match(Op1, m_OneUse(m_Or(m_Value(X), m_Value(Y))))) {
2657 if (RHS && match(Op0, m_OneUse(m_Or(m_Value(X), m_Value(Y))))) {
2679 if (match(Op0, m_OneUse(m_SExt(m_Value(A)))) &&
2682 if (match(Op1, m_OneUse(m_SExt(m_Value(A)))) &&
2693 match(Op0, m_Or(m_Value(A), m_ConstantInt(CI)))) {
2705 match(Op0, m_Select(m_Value(X), m_Value(A), m_Value(B))) &&
2706 match(Op1, m_Select(m_Value(Y), m_Value(C), m_Value(D))) && X == Y) {
2718 if (match(&I, m_c_Or(m_OneUse(m_AShr(m_NSWSub(m_Value(Y), m_Value(X)),
2750 if (match(&I, m_c_Xor(m_And(m_Value(A), m_Value(B)),
2761 if (match(&I, m_Xor(m_c_Or(m_Value(A), m_Not(m_Value(B))),
2772 if (match(&I, m_Xor(m_c_And(m_Value(A), m_Not(m_Value(B))),
2788 if ((match(Op0, m_Or(m_Value(A), m_Value(B))) &&
2789 match(Op1, m_Not(m_c_And(m_Specific(A), m_Specific(B))))) ||
2790 (match(Op0, m_And(m_Value(A), m_Value(B))) &&
2791 match(Op1, m_Not(m_c_Or(m_Specific(A), m_Specific(B))))))
2827 if ((PredL == CmpInst::ICMP_SGT && match(LHS1, m_AllOnes()) &&
2828 PredR == CmpInst::ICMP_SGT && match(RHS1, m_AllOnes())) ||
2829 (PredL == CmpInst::ICMP_SLT && match(LHS1, m_Zero()) &&
2830 PredR == CmpInst::ICMP_SLT && match(RHS1, m_Zero()))) {
2836 if ((PredL == CmpInst::ICMP_SGT && match(LHS1, m_AllOnes()) &&
2837 PredR == CmpInst::ICMP_SLT && match(RHS1, m_Zero())) ||
2838 (PredL == CmpInst::ICMP_SLT && match(LHS1, m_Zero()) &&
2839 PredR == CmpInst::ICMP_SGT && match(RHS1, m_AllOnes()))) {
2911 if (!match(&I, m_c_Xor(m_Value(B),
2919 if (match(M, m_Not(m_Value(NotM)))) {
2926 if (D->hasOneUse() && match(M, m_Constant(C))) {
2948 if (!match(&I, m_Not(m_OneUse(m_Xor(m_Value(X), m_Value(Y))))))
2999 if (match(&I, m_c_Xor(m_c_And(m_Not(m_Value(M)), m_Value()),
3010 if (match(&I, m_Not(m_OneUse(m_c_And(m_Not(m_Value(X)), m_Value(Y)))))) {
3016 if (match(&I, m_Not(m_OneUse(m_c_Or(m_Not(m_Value(X)), m_Value(Y)))))) {
3026 if (match(&I, m_Not(m_BinOp(NotVal)))) {
3045 if (match(NotVal, m_Sub(m_Value(X), m_Value(Y))))
3050 if (match(NotVal, m_AShr(m_Not(m_Value(X)), m_Value(Y))))
3060 if (match(NotVal, m_AShr(m_Constant(C), m_Value(Y))) &&
3061 match(C, m_Negative()))
3065 if (match(NotVal, m_LShr(m_Constant(C), m_Value(Y))) &&
3066 match(C, m_NonNegative()))
3070 if (match(Op0, m_Add(m_Value(X), m_Constant(C))))
3076 if (match(Op1, m_Constant(C1))) {
3078 if (match(Op0, m_OneUse(m_Or(m_Not(m_Value(X)), m_Constant(C2))))) {
3083 if (match(Op0, m_OneUse(m_And(m_Not(m_Value(X)), m_Constant(C2))))) {
3092 if (match(&I, m_Not(m_OneUse(m_Cmp(Pred, m_Value(), m_Value()))))) {
3099 if (match(Op1, m_APInt(RHSC))) {
3102 if (RHSC->isSignMask() && match(Op0, m_Sub(m_APInt(C), m_Value(X)))) {
3107 if (RHSC->isSignMask() && match(Op0, m_Add(m_Value(X), m_APInt(C)))) {
3114 if (match(Op0, m_Or(m_Value(X), m_APInt(C))) &&
3159 if (match(Op1, m_OneUse(m_c_Or(m_Value(X), m_Specific(Op0)))))
3163 if (match(Op0, m_OneUse(m_c_Or(m_Value(X), m_Specific(Op1)))))
3168 if (match(Op1, m_OneUse(m_c_And(m_Value(X), m_Specific(Op0)))))
3175 if (!match(Op1, m_Constant()) &&
3176 match(Op0, m_OneUse(m_c_And(m_Value(X), m_Specific(Op1)))))
3181 if (match(&I, m_c_Xor(m_OneUse(m_Xor(m_Value(A), m_Value(B))),
3187 if (match(&I, m_c_Xor(m_OneUse(m_Xor(m_Value(A), m_Value(B))),
3193 if (match(Op0, m_And(m_Value(A), m_Value(B))) &&
3194 match(Op1, m_c_Xor(m_Specific(A), m_Specific(B))))
3197 if (match(Op0, m_Xor(m_Value(A), m_Value(B))) &&
3198 match(Op1, m_c_And(m_Specific(A), m_Specific(B))))
3203 if (match(Op0, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&
3204 match(Op1, m_Not(m_Specific(A))))
3225 if (match(Op1, m_AShr(m_Value(A), m_APInt(ShAmt))) &&
3227 match(Op0, m_OneUse(m_c_Add(m_Specific(A), m_Specific(Op1))))) {
3251 if (match(Op1, m_AllOnes()) && Op0->hasOneUse()) {
3257 if (match(LHS, m_Not(m_Value(X))) && !isFreeToInvert(X, X->hasOneUse())) {
3265 if (match(RHS, m_Not(m_Value(Y))) && !isFreeToInvert(Y, Y->hasOneUse())) {
lib/Transforms/InstCombine/InstCombineCalls.cpp 652 if (match(CarryIn, m_ZeroInt())) {
1191 if (match(Op0, m_BitReverse(m_Value(X)))) {
1199 if (match(Op0, m_Neg(m_Value(X)))) {
1237 if (!match(II.getArgOperand(1), m_One())) {
1265 if (match(Op0, m_BitReverse(m_Value(X))) || match(Op0, m_BSwap(m_Value(X)))) {
1265 if (match(Op0, m_BitReverse(m_Value(X))) || match(Op0, m_BSwap(m_Value(X)))) {
1894 if (match(IIOperand, m_Trunc(m_BSwap(m_Value(X))))) {
1950 if (match(II->getArgOperand(2), m_Constant(ShAmtC)) &&
1978 if (match(Op1, m_ZeroInt()) || match(Op1, m_Undef()))
1978 if (match(Op1, m_ZeroInt()) || match(Op1, m_Undef()))
1983 if (match(Op0, m_ZeroInt()) || match(Op0, m_Undef()))
1983 if (match(Op0, m_ZeroInt()) || match(Op0, m_Undef()))
1988 if (Op0 == Op1 && BitWidth == 16 && match(ShAmtC, m_SpecificInt(8))) {
2025 bool HasNWAdd = IsSigned ? match(Arg0, m_NSWAdd(m_Value(X), m_APInt(C0)))
2026 : match(Arg0, m_NUWAdd(m_Value(X), m_APInt(C0)));
2027 if (HasNWAdd && match(Arg1, m_APInt(C1))) {
2061 if (match(Arg1, m_Constant(C)) && C->isNotMinSignedValue()) {
2110 if (IID == Intrinsic::ssub_sat && match(Arg1, m_Constant(C)) &&
2128 match(Arg1, m_APInt(Val)) &&
2129 match(Other->getArgOperand(0), m_Value(X)) &&
2130 match(Other->getArgOperand(1), m_APInt(Val2))) {
2163 if (match(Arg0, m_FNeg(m_Value(X))) && match(Arg1, m_FNeg(m_Value(Y))) &&
2163 if (match(Arg0, m_FNeg(m_Value(X))) && match(Arg1, m_FNeg(m_Value(Y))) &&
2194 if (M->getIntrinsicID() == IID && match(Arg1, m_APFloat(C1)) &&
2195 ((match(M->getArgOperand(0), m_Value(X)) &&
2196 match(M->getArgOperand(1), m_APFloat(C2))) ||
2197 (match(M->getArgOperand(1), m_Value(X)) &&
2198 match(M->getArgOperand(0), m_APFloat(C2))))) {
2256 if (match(Src0, m_FNeg(m_Value(X))) && match(Src1, m_FNeg(m_Value(Y)))) {
2256 if (match(Src0, m_FNeg(m_Value(X))) && match(Src1, m_FNeg(m_Value(Y)))) {
2263 if (match(Src0, m_FAbs(m_Value(X))) &&
2264 match(Src1, m_FAbs(m_Specific(X)))) {
2285 if (match(II->getArgOperand(0),
2301 if (match(II->getArgOperand(0), m_OneUse(m_FPExt(m_Value(ExtSrc))))) {
2312 if (match(Src, m_FNeg(m_Value(X))) || match(Src, m_FAbs(m_Value(X)))) {
2312 if (match(Src, m_FNeg(m_Value(X))) || match(Src, m_FAbs(m_Value(X)))) {
2322 if (match(II->getArgOperand(0), m_OneUse(m_FNeg(m_Value(X))))) {
2601 bool Arg0IsZero = match(Arg0, m_PosZeroFP());
2612 if ((match(Arg0, m_OneUse(m_FSub(m_Value(A), m_Value(B)))) &&
2613 match(Arg1, m_PosZeroFP()) && isa<Instruction>(Arg0) &&
3066 if (match(Mask, m_SExt(m_Value(BoolVec))) &&
3303 if (match(KeyArg, m_ZeroInt()) &&
3304 match(DataArg, m_Xor(m_Value(Data), m_Value(Key)))) {
3608 if (match(Src0, m_NaN()) || isa<UndefValue>(Src0)) {
3610 } else if (match(Src1, m_NaN()) || isa<UndefValue>(Src1)) {
3612 } else if (match(Src2, m_NaN()) || isa<UndefValue>(Src2)) {
3721 ((match(Src1, m_One()) && match(Src0, m_ZExt(m_Value(ExtSrc)))) ||
3721 ((match(Src1, m_One()) && match(Src0, m_ZExt(m_Value(ExtSrc)))) ||
3722 (match(Src1, m_AllOnes()) && match(Src0, m_SExt(m_Value(ExtSrc))))) &&
3722 (match(Src1, m_AllOnes()) && match(Src0, m_SExt(m_Value(ExtSrc))))) &&
3743 if (match(Src1, m_Zero()) &&
3744 match(Src0,
3843 if (match(Src, m_Intrinsic<Intrinsic::amdgcn_readfirstlane>()))
3848 if (match(Src, m_Intrinsic<Intrinsic::amdgcn_readlane>()))
3852 if (match(Src, m_Intrinsic<Intrinsic::amdgcn_readlane>(
3927 if (match(Next, m_Intrinsic<Intrinsic::assume>(m_Specific(IIOperand))))
3936 if (match(IIOperand, m_And(m_Value(A), m_Value(B)))) {
3942 if (match(IIOperand, m_Not(m_Or(m_Value(A), m_Value(B))))) {
3954 if (match(IIOperand, m_ICmp(Pred, m_Instruction(LHS), m_Zero())) &&
4043 if (match(NextInst,
lib/Transforms/InstCombine/InstCombineCasts.cpp 309 if ((match(V, m_ZExtOrSExt(m_Value(X))) || match(V, m_Trunc(m_Value(X)))) &&
309 if ((match(V, m_ZExtOrSExt(m_Value(X))) || match(V, m_Trunc(m_Value(X)))) &&
379 if (match(I->getOperand(1), m_APInt(Amt))) {
391 if (match(I->getOperand(1), m_APInt(Amt))) {
409 if (match(I->getOperand(1), m_APInt(Amt))) {
464 if (!match(TruncOp, m_CombineOr(m_BitCast(m_Value(VecInput)),
510 if (!match(Trunc.getOperand(0), m_OneUse(m_Or(m_Value(Or0), m_Value(Or1)))))
514 if (!match(Or0, m_OneUse(m_LogicalShift(m_Value(ShVal), m_Value(ShAmt0)))) ||
515 !match(Or1, m_OneUse(m_LogicalShift(m_Specific(ShVal), m_Value(ShAmt1)))))
528 if (match(R, m_OneUse(m_Sub(m_SpecificInt(Width), m_Specific(L)))))
535 if (match(L, m_And(m_Value(X), m_SpecificInt(Mask))) &&
536 match(R, m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask))))
540 if (match(L, m_ZExt(m_And(m_Value(X), m_SpecificInt(Mask)))) &&
541 match(R, m_ZExt(m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask)))))
586 if (!match(Trunc.getOperand(0), m_OneUse(m_BinOp(BinOp))))
599 if (match(BinOp0, m_Constant(C))) {
605 if (match(BinOp1, m_Constant(C))) {
612 if (match(BinOp0, m_ZExtOrSExt(m_Value(X))) && X->getType() == DestTy) {
617 if (match(BinOp1, m_ZExtOrSExt(m_Value(X))) && X->getType() == DestTy) {
739 if (match(Src, m_OneUse(m_LShr(m_Value(X), m_APInt(C))))) {
745 if (match(Src, m_OneUse(m_c_Or(m_LShr(m_Value(X), m_APInt(C)),
760 match(Src, m_LShr(m_ZExt(m_Value(A)), m_ConstantInt(Cst)))) {
787 match(Src, m_LShr(m_SExt(m_Value(A)), m_ConstantInt(Cst)))) {
825 if (match(Src, m_Shl(m_Value(A), m_ConstantInt(Cst))) &&
826 !match(A, m_Shr(m_Value(), m_Constant()))) {
852 if (match(ICI->getOperand(1), m_APInt(Op1CV))) {
1034 if (match(I->getOperand(1), m_APInt(Amt))) {
1047 if (match(I->getOperand(1), m_APInt(Amt))) {
1207 match(SrcI, m_OneUse(m_And(m_Trunc(m_Value(X)), m_Constant(C)))) &&
1213 if (SrcI && match(SrcI, m_OneUse(m_Xor(m_Value(And), m_Constant(C)))) &&
1214 match(And, m_OneUse(m_And(m_Trunc(m_Value(X)), m_Specific(C)))) &&
1232 if ((Pred == ICmpInst::ICMP_SLT && match(Op1, m_ZeroInt())) ||
1233 (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))) {
1405 if (match(Src, m_OneUse(m_Trunc(m_Value(X)))) && X->getType() == DestTy) {
1432 if (match(Src, m_AShr(m_Shl(m_Trunc(m_Value(A)), m_ConstantInt(BA)),
1624 if (match(Op, m_FNeg(m_Value(X)))) {
2061 !match(BitCast.getOperand(0), m_OneUse(m_BinOp(BO))) ||
2072 if (match(BO->getOperand(0), m_OneUse(m_BitCast(m_Value(X)))) &&
2079 if (match(BO->getOperand(1), m_OneUse(m_BitCast(m_Value(X)))) &&
2091 if (match(BO->getOperand(1), m_Constant(C))) {
2105 if (!match(BitCast.getOperand(0),
2128 if (match(TVal, m_OneUse(m_BitCast(m_Value(X)))) && X->getType() == DestTy &&
2135 if (match(FVal, m_OneUse(m_BitCast(m_Value(X)))) && X->getType() == DestTy &&
lib/Transforms/InstCombine/InstCombineCompares.cpp 1348 if (!match(&I, m_ICmp(Pred, m_OneUse(m_IRem(m_Value(X), m_Value(Y))),
1364 if (!I.isEquality() || !match(&I, m_ICmp(Pred, m_Instruction(Val), m_Zero())))
1371 if (match(Val, m_TruncOrSelf(m_Shr(m_Value(X), m_Constant(C))))) {
1374 if (!match(C, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
1394 if (!match(Cmp.getOperand(1), m_Zero()))
1417 if (match(Cmp.getOperand(0), m_URem(m_Value(X), m_Value(Y))) &&
1449 if (Pred == ICmpInst::ICMP_UGT && match(Op1, m_ConstantInt(CI)) &&
1450 match(Op0, m_Add(m_Add(m_Value(A), m_Value(B)), m_ConstantInt(CI2))))
1468 if (!match(DomBB->getTerminator(), m_Br(m_Value(DomCond), TrueBB, FalseBB)))
1487 if (match(DomCond, m_ICmp(DomPred, m_Specific(X), m_APInt(DomC))) &&
1488 match(Y, m_APInt(C))) {
1536 if (Pred == ICmpInst::ICMP_SLT && match(X, m_Signum(m_Value(V))))
1567 if (!match(Y, m_APInt(XorC)))
1647 if (match(Shift->getOperand(1), m_APInt(C3))) {
1725 match(And->getOperand(1), m_One()))
1730 if (!match(And, m_And(m_Value(X), m_APInt(C2))))
1765 if (match(And->getOperand(0), m_OneUse(m_Trunc(m_Value(W)))) &&
1788 match(And->getOperand(1), m_One())) {
1792 if (match(Or, m_Or(m_Value(LShr), m_Value(A))) &&
1793 match(LShr, m_LShr(m_Specific(A), m_Value(B)))) {
1862 if (And->hasOneUse() && C.isNullValue() && match(Y, m_APInt(C2))) {
1885 if (Pred == ICmpInst::ICMP_SLT && match(Or, m_Signum(m_Value(V))))
1912 if (match(Or, m_Or(m_PtrToInt(m_Value(P)), m_PtrToInt(m_Value(Q))))) {
1926 if (match(OrOp0, m_OneUse(m_Xor(m_Value(X1), m_Value(X2)))) &&
1927 match(OrOp1, m_OneUse(m_Xor(m_Value(X3), m_Value(X4))))) {
1944 if (!match(Mul->getOperand(1), m_APInt(MulC)))
1964 if (!match(Shl, m_Shl(m_One(), m_Value(Y))))
2027 if (Cmp.isEquality() && match(Shl->getOperand(0), m_APInt(ShiftVal)))
2031 if (!match(Shl->getOperand(1), m_APInt(ShiftAmt)))
2175 if (Cmp.isEquality() && match(Shr->getOperand(0), m_APInt(ShiftVal)))
2179 if (!match(Shr->getOperand(1), m_APInt(ShiftAmt)))
2273 if (!C.isNullValue() || !match(SRem->getOperand(1), m_Power2(DivisorC)))
2299 if (!match(UDiv->getOperand(0), m_APInt(C2)))
2334 if (!match(Div->getOperand(1), m_APInt(C2)))
2503 if (match(X, m_APInt(C2)) && *C2 == C && Cmp.isEquality())
2508 if (match(X, m_APInt(C2)) &&
2538 if (!match(X, m_APInt(C2)))
2561 if (Cmp.isEquality() || !match(Y, m_APInt(C2)))
2634 if (!match(SI->getCondition(), m_ICmp(PredA, m_Value(LHS), m_Value(RHS))) ||
2642 if (!match(EqualVal, m_ConstantInt(Equal)))
2646 if (!match(UnequalVal, m_Select(m_ICmp(PredB, m_Value(LHS2), m_Value(RHS2)),
2740 if (match(BCSrcOp, m_SIToFP(m_Value(X)))) {
2747 match(Op1, m_Zero()))
2751 if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One()))
2755 if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))
2763 if (match(BCSrcOp, m_UIToFP(m_Value(X))))
2764 if (Cmp.isEquality() && match(Op1, m_Zero()))
2789 if (!match(Cmp.getOperand(1), m_APInt(C)) ||
2796 if (match(BCSrcOp,
2821 if (!match(Cmp.getOperand(1), m_APInt(C)))
2922 if (match(BOp1, m_APInt(BOC)) && BOC->sgt(1) && BOC->isPowerOf2()) {
2932 if (match(BOp1, m_APInt(BOC))) {
2967 if (match(BOp0, m_APInt(BOC))) {
2979 if (match(BOp1, m_APInt(BOC)) && BO->hasOneUse() && RHS->isAllOnesValue()) {
2991 if (match(BOp1, m_APInt(BOC))) {
3002 if (match(BOp1, m_APInt(BOC)) && !BOC->isNullValue()) {
3288 if (!match(&I, m_c_ICmp(SrcPred,
3327 if (!match(M, m_Constant())) // Can not do this fold with non-constant.
3329 if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
3337 if (!match(M, m_Constant())) // Can not do this fold with non-constant.
3339 if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
3347 if (!match(M, m_Constant())) // Can not do this fold with non-constant.
3349 if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
3357 if (!match(M, m_Constant())) // Can not do this fold with non-constant.
3359 if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
3385 if (!match(&I, m_c_ICmp(SrcPred,
3455 if (!I.isEquality() || !match(I.getOperand(1), m_Zero()) ||
3464 if (!match(
3485 if (match(YShift, m_LShr(m_Value(), m_Value())))
3494 match(XShift, m_BinOp(m_Value(X), m_ZExtOrSelf(m_Value(XShAmt))));
3495 match(YShift, m_BinOp(m_Value(Y), m_ZExtOrSelf(m_Value(YShAmt))));
3502 if (!match(I.getOperand(0),
3530 if (!match(NewShAmt,
3536 if (HadTrunc && match(WidestShift, m_LShr(m_Value(), m_Value()))) {
3610 match(&I, m_c_ICmp(Pred, m_OneUse(m_UDiv(m_AllOnes(), m_Value(X))),
3630 match(&I, m_c_ICmp(Pred, m_Value(Y),
3682 if (match(Op0, m_OneUse(m_c_Add(m_Specific(Op1), m_Value(X)))) &&
3686 if (match(Op1, m_OneUse(m_c_Add(m_Specific(Op0), m_Value(X)))) &&
3754 match(B, m_AllOnes()))
3759 match(B, m_AllOnes()))
3763 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SLE && match(B, m_One()))
3767 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SGT && match(B, m_One()))
3772 match(D, m_AllOnes()))
3777 match(D, m_AllOnes()))
3781 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SGE && match(D, m_One()))
3785 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SLT && match(D, m_One()))
3798 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_ULE && match(B, m_One()))
3802 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_UGT && match(B, m_One()))
3806 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_UGE && match(D, m_One()))
3810 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_ULT && match(D, m_One()))
3890 if (match(BO0, m_Neg(m_Value(X))))
3938 if (match(BO0->getOperand(1), m_APInt(C))) {
3961 if (match(BO0->getOperand(1), m_APInt(C)) && !C->isNullValue() &&
4013 if (match(BO0, BitwiseAnd) && Pred == ICmpInst::ICMP_ULT) {
4041 if (match(X, m_c_SMin(m_Specific(Op0), m_Value())) ||
4042 match(X, m_c_SMax(m_Specific(Op0), m_Value())) ||
4043 match(X, m_c_UMin(m_Specific(Op0), m_Value())) ||
4044 match(X, m_c_UMax(m_Specific(Op0), m_Value()))) {
4050 if (match(Op0, m_c_SMin(m_Specific(X), m_Value(Y)))) {
4067 if (match(Op0, m_c_SMax(m_Specific(X), m_Value(Y)))) {
4084 if (match(Op0, m_c_UMin(m_Specific(X), m_Value(Y)))) {
4101 if (match(Op0, m_c_UMax(m_Specific(X), m_Value(Y)))) {
4128 if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) {
4134 if (match(Op1, m_Xor(m_Value(C), m_Value(D)))) {
4137 if (match(B, m_ConstantInt(C1)) && match(D, m_ConstantInt(C2)) &&
4137 if (match(B, m_ConstantInt(C1)) && match(D, m_ConstantInt(C2)) &&
4156 if (match(Op1, m_Xor(m_Value(A), m_Value(B))) && (A == Op0 || B == Op0)) {
4163 if (match(Op0, m_OneUse(m_And(m_Value(A), m_Value(B)))) &&
4164 match(Op1, m_OneUse(m_And(m_Value(C), m_Value(D))))) {
4197 if ((Op0->hasOneUse() && match(Op0, m_ZExt(m_Value(A))) &&
4198 match(Op1, m_And(m_Value(B), m_ConstantInt(Cst1)))) ||
4199 (Op1->hasOneUse() && match(Op0, m_And(m_Value(B), m_ConstantInt(Cst1))) &&
4200 match(Op1, m_ZExt(m_Value(A))))) {
4209 if ((match(Op0, m_OneUse(m_LShr(m_Value(A), m_ConstantInt(Cst1)))) &&
4210 match(Op1, m_OneUse(m_LShr(m_Value(B), m_Specific(Cst1))))) ||
4211 (match(Op0, m_OneUse(m_AShr(m_Value(A), m_ConstantInt(Cst1)))) &&
4212 match(Op1, m_OneUse(m_AShr(m_Value(B), m_Specific(Cst1)))))) {
4225 if (match(Op0, m_OneUse(m_Shl(m_Value(A), m_ConstantInt(Cst1)))) &&
4226 match(Op1, m_OneUse(m_Shl(m_Value(B), m_Specific(Cst1))))) {
4242 match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A), m_ConstantInt(ShAmt))))) &&
4243 match(Op1, m_ConstantInt(Cst1)) &&
4266 if ((match(Op0, m_BSwap(m_Value(A))) && match(Op1, m_BSwap(m_Value(B)))) ||
4266 if ((match(Op0, m_BSwap(m_Value(A))) && match(Op1, m_BSwap(m_Value(B)))) ||
4267 (match(Op0, m_BitReverse(m_Value(A))) &&
4268 match(Op1, m_BitReverse(m_Value(B)))))
4274 if (!match(Op0, m_OneUse(m_c_And(m_Add(m_Value(A), m_AllOnes()),
4276 !match(Op1, m_ZeroInt()))
4281 if (match(Op0, m_OneUse(m_c_And(m_Neg(m_Specific(Op1)), m_Specific(Op1)))))
4283 else if (match(Op1,
4303 if (!match(CastOp0, m_ZExtOrSExt(m_Value(X))))
4440 return match(RHS, m_Zero());
4442 return match(RHS, m_One());
4613 if (match(OtherVal, m_And(m_Value(ValToMask), m_ConstantInt(CI)))) {
4759 if (!match(I.getOperand(1), m_APInt(RHS)))
4804 if (match(U, m_Sub(m_Specific(Op1), m_Specific(Op0))))
4806 else if (match(U, m_Sub(m_Specific(Op0), m_Specific(Op1))))
4992 if (!match(Op0, m_And(m_Value(LHS), m_APInt(LHSC))) ||
4997 if (match(LHS, m_Shl(m_One(), m_Value(X)))) {
5019 match(LHS, m_LShr(m_Power2(CI), m_Value(X)))) {
5038 if (match(Op1, m_APInt(CmpC))) {
5060 if (match(Op1, m_APInt(CmpC))) {
5081 if (match(Op1, m_APInt(CmpC))) {
5096 if (match(Op1, m_APInt(CmpC))) {
5235 if (match(B, m_Zero())) {
5244 } else if (match(B, m_One())) {
5310 if (match(&Cmp,
5326 } else if (match(&Cmp, m_c_ICmp(Pred,
5364 if (match(LHS, m_ShuffleVector(m_Value(V1), m_Undef(), m_Constant(M))) &&
5365 match(RHS, m_ShuffleVector(m_Value(V2), m_Undef(), m_Specific(M))) &&
5399 if (I.getPredicate() == ICmpInst::ICMP_NE && match(Op1, m_Zero())) {
5401 if (match(Op0, m_Select(m_Value(Cond), m_Value(SelectTrue),
5461 if (match(Op1, m_APInt(C))) {
5520 if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&
5521 match(Op1, m_Zero()) &&
5528 if (match(Op0, m_Not(m_Value(A)))) {
5529 if (match(Op1, m_Not(m_Value(B))))
5533 if (match(Op1, m_APInt(C)))
5539 if (match(&I, m_UAddWithOverflow(m_Value(A), m_Value(B),
5552 if (match(Op0, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))) {
5556 if (match(Op1, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))) {
5585 if (match(Op0, m_Add(m_Value(X), m_APInt(C))) && Op1 == X)
5589 if (match(Op1, m_Add(m_Value(X), m_APInt(C))) && Op0 == X)
5866 if (!match(RHSC, m_AnyZeroFP()))
5876 if (!match(LHSI->getOperand(0), m_APFloat(C)))
5892 if (!match(I.getOperand(0), m_Intrinsic<Intrinsic::fabs>(m_Value(X))) ||
5893 !match(I.getOperand(1), m_PosZeroFP()))
5999 if (!match(Op0, m_PosZeroFP()) && isKnownNeverNaN(Op0, &TLI)) {
6003 if (!match(Op1, m_PosZeroFP()) && isKnownNeverNaN(Op1, &TLI)) {
6011 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
6011 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
6031 if (match(Op1, m_AnyZeroFP()) && !match(Op1, m_PosZeroFP())) {
6031 if (match(Op1, m_AnyZeroFP()) && !match(Op1, m_PosZeroFP())) {
6039 if (match(Op0, m_Instruction(LHSI)) && match(Op1, m_Constant(RHSC))) {
6039 if (match(Op0, m_Instruction(LHSI)) && match(Op1, m_Constant(RHSC))) {
6072 if (match(Op0, m_FNeg(m_Value(X)))) {
6075 if (match(Op1, m_Constant(C))) {
6081 if (match(Op0, m_FPExt(m_Value(X)))) {
6083 if (match(Op1, m_FPExt(m_Value(Y))) && X->getType() == Y->getType())
6088 if (match(Op1, m_APFloat(C))) {
lib/Transforms/InstCombine/InstCombineInternal.h 85 if (isa<CastInst>(V) || match(V, m_Neg(m_Value())) ||
86 match(V, m_Not(m_Value())) || match(V, m_FNeg(m_Value())))
86 match(V, m_Not(m_Value())) || match(V, m_FNeg(m_Value())))
188 if (match(V, m_Not(m_Value())))
192 if (match(V, m_AnyIntegralConstant()))
209 if (match(V, m_Select(m_Value(), m_Not(m_Value()), m_Not(m_Value()))))
230 if (!match(I, m_Not(m_Value())))
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 460 if (!(match(Ptr, m_BitCast(m_Value(NewPtr))) &&
540 if (!match(V, m_Select(m_Cmp(Pred, m_Instruction(L1), m_Instruction(L2)),
543 return (match(L1, m_Load(m_Specific(LHS))) &&
544 match(L2, m_Load(m_Specific(RHS)))) ||
545 (match(L1, m_Load(m_Specific(RHS))) &&
546 match(L2, m_Load(m_Specific(LHS))));
1316 if (!match(SI.getPointerOperand(), m_BitCast(m_Value())))
1320 if (!match(SI.getValueOperand(), m_Load(m_BitCast(m_Value(LoadAddr)))))
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp 61 if (match(V, m_LShr(m_OneUse(m_Shl(m_Value(One), m_Value(A))), m_Value(B))) &&
62 match(One, m_One())) {
104 if (match(C, m_APInt(IVal)) && IVal->isPowerOf2())
119 if (!match(Elt, m_APInt(IVal)) || !IVal->isPowerOf2())
138 if (match(&I, m_c_Mul(m_OneUse(m_Select(m_Value(Cond), m_One(), m_AllOnes())),
144 if (match(&I, m_c_Mul(m_OneUse(m_Select(m_Value(Cond), m_AllOnes(), m_One())),
150 if (match(&I, m_c_FMul(m_OneUse(m_Select(m_Value(Cond), m_SpecificFP(1.0),
160 if (match(&I, m_c_FMul(m_OneUse(m_Select(m_Value(Cond), m_SpecificFP(-1.0),
187 if (match(Op1, m_AllOnes())) {
199 if (match(&I, m_Mul(m_Shl(m_Value(NewOp), m_Constant(C2)),
201 match(C1, m_APInt(IVal))) {
214 if (match(&I, m_Mul(m_Value(NewOp), m_Constant(C1)))) {
223 if (match(NewCst, m_APInt(V)) && *V != V->getBitWidth() - 1)
244 if (match(Op0, m_Sub(m_Value(Y), m_Value(X))))
246 else if (match(Op0, m_Add(m_Value(Y), m_ConstantInt(C1))))
268 if (match(Op0, m_OneUse(m_Add(m_Value(X), m_Constant(C1))))) {
272 if (!match(Mul, m_Mul(m_Value(), m_Value())))
280 if (match(Op0, m_Neg(m_Value(X))) && match(Op1, m_Constant(Op1C)))
280 if (match(Op0, m_Neg(m_Value(X))) && match(Op1, m_Constant(Op1C)))
284 if (match(Op0, m_Neg(m_Value(X))) && match(Op1, m_Neg(m_Value(Y)))) {
284 if (match(Op0, m_Neg(m_Value(X))) && match(Op1, m_Neg(m_Value(Y)))) {
295 if (match(&I, m_c_Mul(m_OneUse(m_Neg(m_Value(X))), m_Value(Y))))
341 if (match(Op0, m_Shl(m_One(), m_Value(Y)))) {
344 } else if (match(Op1, m_Shl(m_One(), m_Value(Y)))) {
359 if (match(Op0, m_ZExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1))
361 if (match(Op1, m_ZExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1))
371 if (match(Op0, m_LShr(m_Value(X), m_APInt(C))) && *C == C->getBitWidth() - 1)
373 if (match(Op1, m_LShr(m_Value(X), m_APInt(C))) && *C == C->getBitWidth() - 1)
413 if (match(Op1, m_SpecificFP(-1.0)))
418 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
418 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
423 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_Constant(C)))
423 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_Constant(C)))
427 if (Op0 == Op1 && match(Op0, m_Intrinsic<Intrinsic::fabs>(m_Value(X))))
437 if (match(Op1, m_Constant(C)) && C->isFiniteNonZeroFP()) {
439 if (match(Op0, m_OneUse(m_FDiv(m_Constant(C1), m_Value(X))))) {
445 if (match(Op0, m_FDiv(m_Value(X), m_Constant(C1)))) {
461 if (match(Op0, m_OneUse(m_FAdd(m_Value(X), m_Constant(C1))))) {
467 if (match(Op0, m_OneUse(m_FSub(m_Constant(C1), m_Value(X))))) {
476 if (match(&I, m_c_FMul(m_OneUse(m_FDiv(m_Value(X), m_Value(Y))),
487 match(Op0, m_OneUse(m_Intrinsic<Intrinsic::sqrt>(m_Value(X)))) &&
488 match(Op1, m_OneUse(m_Intrinsic<Intrinsic::sqrt>(m_Value(Y))))) {
500 if (match(Op0, m_FDiv(m_Value(X),
506 if (match(Op0, m_FDiv(m_Intrinsic<Intrinsic::sqrt>(m_Value(Y)),
515 if (match(Op0, m_Intrinsic<Intrinsic::exp>(m_Value(X))) &&
516 match(Op1, m_Intrinsic<Intrinsic::exp>(m_Value(Y))) &&
525 if (match(Op0, m_Intrinsic<Intrinsic::exp2>(m_Value(X))) &&
526 match(Op1, m_Intrinsic<Intrinsic::exp2>(m_Value(Y))) &&
540 if (match(Op0, m_OneUse(m_c_FMul(m_Specific(Op1), m_Value(Y)))) &&
545 if (match(Op1, m_OneUse(m_c_FMul(m_Specific(Op0), m_Value(Y)))) &&
555 if (match(Op0, m_OneUse(m_Intrinsic<Intrinsic::log2>(
560 if (match(Op1, m_OneUse(m_Intrinsic<Intrinsic::log2>(
585 if (match(SI->getTrueValue(), m_Zero()))
588 else if (match(SI->getFalseValue(), m_Zero()))
697 if (match(Op1, m_APInt(C2))) {
702 if ((IsSigned && match(Op0, m_SDiv(m_Value(X), m_APInt(C1)))) ||
703 (!IsSigned && match(Op0, m_UDiv(m_Value(X), m_APInt(C1))))) {
710 if ((IsSigned && match(Op0, m_NSWMul(m_Value(X), m_APInt(C1)))) ||
711 (!IsSigned && match(Op0, m_NUWMul(m_Value(X), m_APInt(C1))))) {
733 if ((IsSigned && match(Op0, m_NSWShl(m_Value(X), m_APInt(C1))) &&
735 (!IsSigned && match(Op0, m_NUWShl(m_Value(X), m_APInt(C1))))) {
764 if (match(Op0, m_One())) {
786 if (match(Op0, m_Sub(m_Value(X), m_Value(Z)))) // (X - Z) / Y; Y = Op1
787 if ((IsSigned && match(Z, m_SRem(m_Specific(X), m_Specific(Op1)))) ||
788 (!IsSigned && match(Z, m_URem(m_Specific(X), m_Specific(Op1)))))
793 if (IsSigned && match(Op0, m_NSWShl(m_Specific(Op1), m_Value(Y))))
795 if (!IsSigned && match(Op0, m_NUWShl(m_Specific(Op1), m_Value(Y))))
799 if (match(Op1, m_c_Mul(m_Specific(Op0), m_Value(Y)))) {
862 if (!match(Op1, m_ZExt(m_Value(ShiftLeft))))
867 if (!match(ShiftLeft, m_Shl(m_Constant(CI), m_Value(N))))
890 if (match(Op1, m_Power2())) {
896 if (match(Op1, m_Shl(m_Power2(), m_Value())) ||
897 match(Op1, m_ZExt(m_Shl(m_Power2(), m_Value())))) {
926 if (match(N, m_ZExt(m_Value(X))) && match(D, m_ZExt(m_Value(Y))) &&
926 if (match(N, m_ZExt(m_Value(X))) && match(D, m_ZExt(m_Value(Y))) &&
935 if ((match(N, m_OneUse(m_ZExt(m_Value(X)))) && match(D, m_Constant(C))) ||
935 if ((match(N, m_OneUse(m_ZExt(m_Value(X)))) && match(D, m_Constant(C))) ||
936 (match(D, m_OneUse(m_ZExt(m_Value(X)))) && match(N, m_Constant(C)))) {
936 (match(D, m_OneUse(m_ZExt(m_Value(X)))) && match(N, m_Constant(C)))) {
969 if (match(Op0, m_LShr(m_Value(X), m_APInt(C1))) && match(Op1, m_APInt(C2))) {
969 if (match(Op0, m_LShr(m_Value(X), m_APInt(C1))) && match(Op1, m_APInt(C2))) {
974 bool IsExact = I.isExact() && match(Op0, m_Exact(m_Value()));
986 if (match(Op1, m_Negative())) {
991 if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
1005 if (match(Op0, m_NUWMul(m_Value(A), m_Value(B)))) {
1006 if (match(Op1, m_NUWMul(m_Specific(A), m_Value(X))) ||
1007 match(Op1, m_NUWMul(m_Value(X), m_Specific(A))))
1009 if (match(Op1, m_NUWMul(m_Specific(B), m_Value(X))) ||
1010 match(Op1, m_NUWMul(m_Value(X), m_Specific(B))))
1064 if (match(Op1, m_AllOnes()) ||
1065 (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)))
1069 if (match(Op1, m_SignMask()))
1073 if (match(Op1, m_APInt(Op1C))) {
1084 if (match(Op0, m_OneUse(m_SExt(m_Value(Op0Src)))) &&
1101 match(Op0, m_NSWSub(m_Zero(), m_Value(X)))) {
1111 if (match(&I, m_SDiv(m_OneUse(m_NSWSub(m_Zero(), m_Value(X))), m_Value(Y))))
1143 if (!match(I.getOperand(1), m_Constant(C)))
1148 if (match(I.getOperand(0), m_FNeg(m_Value(X))))
1172 if (!match(I.getOperand(0), m_Constant(C)))
1177 if (match(I.getOperand(1), m_FNeg(m_Value(X))))
1185 if (match(I.getOperand(1), m_FMul(m_Value(X), m_Constant(C2)))) {
1188 } else if (match(I.getOperand(1), m_FDiv(m_Value(X), m_Constant(C2)))) {
1230 if (match(Op0, m_OneUse(m_FDiv(m_Value(X), m_Value(Y)))) &&
1236 if (match(Op1, m_OneUse(m_FDiv(m_Value(X), m_Value(Y)))) &&
1248 bool IsTan = match(Op0, m_Intrinsic<Intrinsic::sin>(m_Value(X))) &&
1249 match(Op1, m_Intrinsic<Intrinsic::cos>(m_Specific(X)));
1251 !IsTan && match(Op0, m_Intrinsic<Intrinsic::cos>(m_Value(X))) &&
1252 match(Op1, m_Intrinsic<Intrinsic::sin>(m_Specific(X)));
1271 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y)))) {
1271 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y)))) {
1281 match(Op1, m_c_FMul(m_Specific(Op0), m_Value(Y)))) {
1290 (match(&I,
1292 match(&I, m_FDiv(m_Intrinsic<Intrinsic::fabs>(m_Value(X)),
1325 if (match(Op1, m_APInt(Op1Int)) && !Op1Int->isMinValue() &&
1371 if (match(Op0, m_One()))
1375 if (match(Op1, m_Negative())) {
1386 if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
1410 if (match(Op1, m_Negative(Y)) && !Y->isMinSignedValue()) {
1419 if (match(&I, m_SRem(m_OneUse(m_NSWSub(m_Zero(), m_Value(X))), m_Value(Y))))
lib/Transforms/InstCombine/InstCombinePHI.cpp 1183 match(CmpInst->getOperand(1), m_Zero())) {
lib/Transforms/InstCombine/InstCombineSelect.cpp 64 if (!match(Sel.getCondition(), m_Cmp(Pred, m_Value(X), m_Constant(C))))
79 if (!match(Sel.getOperand(IsEq ? 1 : 2), m_BinOp(BO)))
89 if (!match(IdC, m_AnyZeroFP()) || !match(C, m_AnyZeroFP()))
89 if (!match(IdC, m_AnyZeroFP()) || !match(C, m_AnyZeroFP()))
95 if (!BO->isCommutative() && !match(BO, m_BinOp(m_Value(Y), m_Specific(X))))
97 if (!match(BO, m_c_BinOp(m_Value(Y), m_Specific(X))))
126 if (!match(Sel.getTrueValue(), m_APInt(SelTC)) ||
127 !match(Sel.getFalseValue(), m_APInt(SelFC)))
140 if (!match(Cmp->getOperand(1), m_Zero()))
145 if (!match(V, m_And(m_Value(), m_Power2(AndRHS))))
288 if ((match(&SI, m_SMin(m_Value(), m_Value())) ||
289 match(&SI, m_SMax(m_Value(), m_Value())) ||
290 match(&SI, m_UMin(m_Value(), m_Value())) ||
291 match(&SI, m_UMax(m_Value(), m_Value()))))
338 if (match(TI, m_FNeg(m_Value(X))) && match(FI, m_FNeg(m_Value(Y))) &&
338 if (match(TI, m_FNeg(m_Value(X))) && match(FI, m_FNeg(m_Value(Y))) &&
444 bool OOpIsAPInt = match(OOp, m_APInt(OOpC));
475 bool OOpIsAPInt = match(OOp, m_APInt(OOpC));
506 match(Cmp->getOperand(1), m_Zero()) && match(FVal, m_One())))
506 match(Cmp->getOperand(1), m_Zero()) && match(FVal, m_One())))
511 if (!match(TVal, m_OneUse(m_And(m_Value(B), m_One()))))
516 const bool HasShift = match(B, m_OneUse(m_LShr(m_Value(X), m_Value(Z))));
521 if (!match(Cmp->getOperand(0), m_c_And(m_Specific(X), m_Value(Y))))
551 !match(CmpRHS,
554 !match(CmpRHS,
562 if (match(TrueVal, m_LShr(m_Value(X), m_Value(Y))) &&
563 match(FalseVal, m_AShr(m_Specific(X), m_Specific(Y))) &&
564 match(CmpLHS, m_Specific(X))) {
604 if (!match(CmpRHS, m_Zero()))
608 if (!match(CmpLHS, m_And(m_Value(), m_Power2(C1))))
619 if ((IsEqualZero && !match(CmpRHS, m_AllOnes())) ||
620 (!IsEqualZero && !match(CmpRHS, m_Zero())))
623 if (!match(CmpLHS, m_OneUse(m_Trunc(m_Value(V)))))
634 bool OrOnFalseVal = match(FalseVal, m_Or(m_Specific(TrueVal), m_Power2(C2)));
636 OrOnTrueVal = match(TrueVal, m_Or(m_Specific(FalseVal), m_Power2(C2)));
689 if (match(TrueVal, m_Zero())) {
693 if (!match(FalseVal, m_Zero()))
709 if (match(TrueVal, m_Sub(m_Specific(B), m_Specific(A))))
711 else if (!match(TrueVal, m_Sub(m_Specific(A), m_Specific(B))))
739 match(TVal, m_Add(m_Value(X), m_APInt(C))) && X == Cmp0 &&
740 match(FVal, m_AllOnes()) && match(Cmp1, m_APInt(CmpC)) && *CmpC == ~*C) {
740 match(FVal, m_AllOnes()) && match(Cmp1, m_APInt(CmpC)) && *CmpC == ~*C) {
751 if (match(FVal, m_AllOnes())) {
755 if (!match(TVal, m_AllOnes()))
768 if (match(Cmp0, m_Not(m_Value(X))) &&
769 match(FVal, m_c_Add(m_Specific(X), m_Value(Y))) && Y == Cmp1) {
777 if (match(FVal, m_c_Add(m_Not(m_Specific(X)), m_Specific(Y)))) {
785 if (match(Cmp0, m_c_Add(m_Specific(Cmp1), m_Value(Y))) &&
786 match(FVal, m_c_Add(m_Specific(Cmp1), m_Specific(Y)))) {
807 if (!ICI->isEquality() || !match(ICI->getOperand(1), m_Zero()))
813 if (!match(FalseVal,
817 if (!match(TrueVal, m_Intrinsic<Intrinsic::ctlz>()))
822 if (!match(II->getOperand(0), m_c_And(m_Specific(X), m_Neg(m_Specific(X)))))
849 if (!ICI->isEquality() || !match(CmpRHS, m_Zero()))
859 if (match(Count, m_ZExt(m_Value(V))) ||
860 match(Count, m_Trunc(m_Value(V))))
865 if (!match(Count, m_Intrinsic<Intrinsic::cttz>(m_Specific(CmpLHS))) &&
866 !match(Count, m_Intrinsic<Intrinsic::ctlz>(m_Specific(CmpLHS))))
874 if (match(ValueOnZero, m_SpecificInt(SizeOfInBits))) {
885 if (II->hasOneUse() && !match(II->getArgOperand(1), m_One()))
903 if (!Cmp.hasOneUse() || !match(CmpRHS, m_APInt(CmpC)))
937 if (match(TrueVal, m_SExt(m_Specific(CmpLHS))) && SextRHS == FalseVal) {
940 } else if (match(FalseVal, m_SExt(m_Specific(CmpLHS))) &&
950 if (match(TrueVal, m_ZExt(m_Specific(CmpLHS))) && ZextRHS == FalseVal) {
953 } else if (match(FalseVal, m_ZExt(m_Specific(CmpLHS))) &&
1050 bool CmpUsesNegatedOp = match(Cmp.getOperand(0), m_Neg(m_Specific(TVal))) ||
1051 match(Cmp.getOperand(0), m_Neg(m_Specific(FVal)));
1054 match(Cmp.getOperand(1), m_ZeroInt()) &&
1056 bool RHSCanonicalized = match(RHS, m_Neg(m_Specific(LHS)));
1189 if (!match(Cmp0.getOperand(1),
1205 if (!match(C0,
1231 else if (!match(Cmp00,
1240 if (!match(Sel1, m_Select(m_Value(Cmp1), m_Value(ReplacementLow),
1242 !match(Cmp1,
1265 if (!match(C2,
1288 if (!match(Precond1, m_One()))
1293 if (!match(Precond2, m_One()))
1321 if (!match(&Cmp, m_OneUse(m_ICmp(
1343 match(&Sel, m_Select(m_Value(), m_Value(SelVal0), m_Value(SelVal1)));
1346 if (!match(SelVal0, m_AnyIntegralConstant()) &&
1347 !match(SelVal1, m_AnyIntegralConstant()))
1435 match(CmpLHS, m_And(m_Value(X), m_Power2(Y))) &&
1436 match(CmpRHS, m_Zero())) {
1439 } else if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, m_Zero())) {
1444 } else if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, m_AllOnes())) {
1454 match(FalseVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C)
1458 match(TrueVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C)
1462 match(TrueVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C)
1466 match(FalseVal, m_Xor(m_Specific(X), m_APInt(C))) && *Y == *C)
1563 if (match(B, m_APInt(CB)) && match(C, m_APInt(CC))) {
1563 if (match(B, m_APInt(CB)) && match(C, m_APInt(CC))) {
1589 ((SPF1 == SPF_UMIN && match(C, m_c_UMax(m_Specific(A), m_Specific(B)))) ||
1590 (SPF1 == SPF_SMIN && match(C, m_c_SMax(m_Specific(A), m_Specific(B)))) ||
1591 (SPF1 == SPF_UMAX && match(C, m_c_UMin(m_Specific(A), m_Specific(B)))) ||
1592 (SPF1 == SPF_SMAX && match(C, m_c_SMin(m_Specific(A), m_Specific(B))))))
1615 if (match(V, m_Not(m_Value(NotV)))) {
1737 if (!match(Sel.getTrueValue(), m_Constant(C)) &&
1738 !match(Sel.getFalseValue(), m_Constant(C)))
1742 if (!match(Sel.getTrueValue(), m_Instruction(ExtInst)) &&
1743 !match(Sel.getFalseValue(), m_Instruction(ExtInst)))
1801 if (!CondVal->getType()->isVectorTy() || !match(CondVal, m_Constant(CondC)))
1846 if (!match(Cond, m_OneUse(m_ExtractElement(m_Value(), m_ConstantInt()))))
1869 if (!match(Cond, m_Cmp(Pred, m_Value(A), m_Value(B))))
1878 if (!match(A, m_BitCast(m_Value(C))) || !match(B, m_BitCast(m_Value(D))))
1878 if (!match(A, m_BitCast(m_Value(C))) || !match(B, m_BitCast(m_Value(D))))
1883 if (!match(TVal, m_BitCast(m_Value(TSrc))) ||
1884 !match(FVal, m_BitCast(m_Value(FSrc))))
1987 if (IsUnsigned && match(X, m_NUWAdd(m_Value(A), m_APInt(C1))) &&
1988 match(Y, m_APInt(C2)) && C2->uge(*C1) && X->hasNUses(2)) {
1997 if (!IsUnsigned && match(X, m_NSWAdd(m_Value(A), m_APInt(C1))) &&
1998 match(Y, m_APInt(C2)) && X->hasNUses(2)) {
2024 if (match(&MinMax1, m_SMin(m_Instruction(MinMax2), m_APInt(MaxValue)))) {
2025 if (!match(MinMax2, m_SMax(m_BinOp(AddSub), m_APInt(MinValue))))
2027 } else if (match(&MinMax1,
2029 if (!match(MinMax2, m_SMin(m_BinOp(AddSub), m_APInt(MaxValue))))
2054 if(!match(AddSub, m_BinOp(m_SExt(m_Value(A)), m_SExt(m_Value(B)))))
2143 if (!match(Sel.getFalseValue(), m_OneUse(m_Or(m_Value(Or0), m_Value(Or1)))))
2148 if (!match(Or0, m_OneUse(m_LogicalShift(m_Specific(TVal), m_Value(SA0)))) ||
2149 !match(Or1, m_OneUse(m_LogicalShift(m_Specific(TVal), m_Value(SA1)))))
2167 if (match(SA1, m_OneUse(m_Sub(m_SpecificInt(Width), m_Specific(SA0)))))
2169 else if (match(SA0, m_OneUse(m_Sub(m_SpecificInt(Width), m_Specific(SA1)))))
2177 if (!match(Cond, m_OneUse(m_ICmp(Pred, m_Specific(ShAmt), m_ZeroInt()))) ||
2227 if (match(CondVal, m_OneUse(m_ICmp(Pred, m_Value(), m_Value()))) &&
2241 if (match(TrueVal, m_One())) {
2245 if (match(TrueVal, m_Zero())) {
2250 if (match(FalseVal, m_Zero())) {
2254 if (match(FalseVal, m_One())) {
2269 if (match(TrueVal, m_Not(m_Specific(CondVal))))
2271 if (match(FalseVal, m_Not(m_Specific(CondVal))))
2284 if (match(TrueVal, m_One()) && match(FalseVal, m_Zero()))
2284 if (match(TrueVal, m_One()) && match(FalseVal, m_Zero()))
2288 if (match(TrueVal, m_AllOnes()) && match(FalseVal, m_Zero()))
2288 if (match(TrueVal, m_AllOnes()) && match(FalseVal, m_Zero()))
2292 if (match(TrueVal, m_Zero()) && match(FalseVal, m_One())) {
2292 if (match(TrueVal, m_Zero()) && match(FalseVal, m_One())) {
2298 if (match(TrueVal, m_Zero()) && match(FalseVal, m_AllOnes())) {
2298 if (match(TrueVal, m_Zero()) && match(FalseVal, m_AllOnes())) {
2353 if (match(CondVal, m_FCmp(Pred, m_Specific(FalseVal), m_AnyZeroFP())) &&
2354 match(TrueVal, m_FSub(m_PosZeroFP(), m_Specific(FalseVal))) &&
2355 match(TrueVal, m_Instruction(FSub)) && FSub->hasNoNaNs() &&
2361 if (match(CondVal, m_FCmp(Pred, m_Specific(TrueVal), m_AnyZeroFP())) &&
2362 match(FalseVal, m_FSub(m_PosZeroFP(), m_Specific(TrueVal))) &&
2363 match(FalseVal, m_Instruction(FSub)) && FSub->hasNoNaNs() &&
2372 if (match(CondVal, m_FCmp(Pred, m_Specific(FalseVal), m_AnyZeroFP())) &&
2373 match(TrueVal, m_FNeg(m_Specific(FalseVal))) &&
2374 match(TrueVal, m_Instruction(FNeg)) &&
2384 if (match(CondVal, m_FCmp(Pred, m_Specific(TrueVal), m_AnyZeroFP())) &&
2385 match(FalseVal, m_FNeg(m_Specific(TrueVal))) &&
2386 match(FalseVal, m_Instruction(FNeg)) &&
2474 if (match(X, m_Not(m_Value(A))) && !X->hasNUsesOrMore(3) &&
2514 if (match(&SI, m_OrdFMax(m_Value(X), m_Value(Y))))
2518 if (match(&SI, m_OrdFMin(m_Value(X), m_Value(Y))))
2587 if (match(TrueVal, m_OneUse(m_BinOp(TrueBO))) &&
2607 if (match(FalseVal, m_OneUse(m_BinOp(FalseBO))) &&
2626 if (match(CondVal, m_Not(m_Value(NotCond)))) {
lib/Transforms/InstCombine/InstCombineShifts.cpp 37 if (!match(Sh0,
46 match(Sh0Op0,
53 if (!match(Sh1, m_Shift(m_Value(X), m_ZExtOrSelf(m_Value(ShAmt1)))))
62 bool HadTwoRightShifts = match(Sh0, m_Shr(m_Value(), m_Value())) &&
63 match(Sh1, m_Shr(m_Value(), m_Value()));
79 !match(Sh0, m_c_BinOp(m_OneUse(m_Value()), m_Value())))
91 if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
102 if (!match(NewShAmt,
143 if (C && match(C, m_Undef()))
150 NewOps[i] = EltC && match(EltC, m_Undef()) ? Replacement : EltC;
183 match(OuterShift, m_Shift(m_Value(Masked), m_Value(ShiftShAmt)));
206 if (match(Masked, m_c_And(m_CombineOr(MaskA, MaskB), m_Value(X)))) {
228 } else if (match(Masked, m_c_And(m_CombineOr(MaskC, MaskD), m_Value(X))) ||
229 match(Masked, m_Shr(m_Shl(m_Value(X), m_Value(MaskShAmt)),
263 bool NeedMask = !match(NewMask, m_AllOnes());
271 if (match(Masked, m_AShr(m_Value(), m_Value())))
292 if (match(Op1, m_OneUse(m_SExt(m_Value(Y))))) {
319 if (match(Op0, m_Constant()) && match(Op1, m_Add(m_Value(A), m_Constant(C))))
319 if (match(Op0, m_Constant()) && match(Op1, m_Add(m_Value(A), m_Constant(C))))
329 if (Op1->hasOneUse() && match(Op1, m_SRem(m_Value(A), m_Power2(B)))) {
350 if (!match(InnerShift->getOperand(1), m_APInt(InnerShiftConst)))
409 if ((IsLeftShift && match(I, m_LShr(m_Value(), m_ConstantInt(CI)))) ||
410 (!IsLeftShift && match(I, m_Shl(m_Value(), m_ConstantInt(CI))))) {
477 match(InnerShift->getOperand(1), m_APInt(C1));
607 if (!match(Op1, m_APInt(Op1C)))
692 match(Op0BO->getOperand(1), m_Shr(m_Value(V1),
711 match(Op0BOOp1,
727 match(Op0BO->getOperand(0), m_Shr(m_Value(V1),
745 match(Op0BO->getOperand(0),
765 if (match(Op0BO->getOperand(1), m_APInt(Op0C))) {
783 match(Op0BO->getOperand(0), m_APInt(Op0C))) {
805 if (match(Op0, m_Select(m_Value(Cond), m_OneUse(m_BinOp(TBO)),
809 match(TBO->getOperand(1), m_APInt(C)) &&
824 if (match(Op0, m_Select(m_Value(Cond), m_Value(TrueVal),
828 match(FBO->getOperand(1), m_APInt(C)) &&
866 if (match(Op1, m_APInt(ShAmtAPInt))) {
872 if (match(Op0, m_OneUse(m_ZExt(m_Value(X))))) {
880 if (match(Op0, m_Shr(m_Value(X), m_Specific(Op1)))) {
888 if (match(Op0, m_Exact(m_Shr(m_Value(X), m_APInt(ShOp1))))) {
908 if (match(Op0, m_Shl(m_Value(X), m_APInt(ShOp1)))) {
933 if (match(Op0, m_OneUse(m_Shr(m_Value(X), m_Specific(Op1))))) {
940 if (match(Op1, m_Constant(C1))) {
944 if (match(Op0, m_OneUse(m_Shl(m_Constant(C2), m_Value(X)))))
948 if (match(Op0, m_Mul(m_Value(X), m_Constant(C2))))
952 if (match(Op0, m_ZExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
959 if (match(Op0, m_One()) &&
960 match(Op1, m_Sub(m_SpecificInt(BitWidth - 1), m_Value(X))))
981 if (match(Op1, m_APInt(ShAmtAPInt))) {
1000 if (match(Op0, m_Shl(m_Value(X), m_APInt(ShOp1))) && ShOp1->ult(BitWidth)) {
1035 if (match(Op0, m_OneUse(m_ZExt(m_Value(X)))) &&
1044 if (match(Op0, m_SExt(m_Value(X))) &&
1069 if (match(Op0, m_LShr(m_Value(X), m_APInt(ShOp1)))) {
1087 if (match(Op0, m_OneUse(m_Shl(m_Value(X), m_Specific(Op1))))) {
1104 return match(
1115 if (!match(&OldAShr,
1126 match(MaybeTrunc, m_TruncOrSelf(m_Instruction(HighBitExtract)));
1131 if (!match(HighBitExtract, m_Shr(m_Value(X), m_Value(NumLowBitsToSkip))))
1136 if (!match(NumLowBitsToSkip,
1150 if (HadTrunc && !match(&OldAShr, m_c_BinOp(m_OneUse(m_Value()), m_Value())))
1180 if (match(Op1, m_APInt(ShAmtAPInt)) && ShAmtAPInt->ult(BitWidth)) {
1187 if (match(Op0, m_Shl(m_ZExt(m_Value(X)), m_Specific(Op1))) &&
1194 if (match(Op0, m_NSWShl(m_Value(X), m_APInt(ShOp1))) &&
1213 if (match(Op0, m_AShr(m_Value(X), m_APInt(ShOp1))) &&
1222 if (match(Op0, m_OneUse(m_SExt(m_Value(X)))) &&
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 47 if (!match(Op, m_APInt(C)))
325 if (match(RHS, m_APInt(C)) && CTZ >= C->getActiveBits())
334 if (match(RHS, m_APInt(C)) &&
467 if (match(I->getOperand(1), m_APInt(SA))) {
469 if (match(I->getOperand(0), m_Shr(m_Value(), m_APInt(ShrAmt))))
498 if (match(I->getOperand(1), m_APInt(SA))) {
537 if (match(I->getOperand(1), m_APInt(SA))) {
582 if (match(I->getOperand(1), m_APInt(SA))) {
694 if (!match(I->getOperand(2), m_APInt(SA)))
1712 if (match(I, m_BinOp(BO)) && !BO->isIntDivRem() && !BO->isShift()) {
lib/Transforms/InstCombine/InstCombineVectorOps.cpp 60 if (match(V, m_InsertElement(m_Value(), m_Value(), m_ConstantInt())))
63 if (match(V, m_OneUse(m_Load(m_Value()))))
67 if (match(V, m_OneUse(m_BinOp(m_Value(V0), m_Value(V1)))))
73 if (match(V, m_OneUse(m_Cmp(UnusedPred, m_Value(V0), m_Value(V1)))))
167 if (!match(Ext.getVectorOperand(), m_BitCast(m_Value(X))) ||
169 !match(Ext.getIndexOperand(), m_ConstantInt(ExtIndexC)))
188 if (!match(X, m_InsertElement(m_Value(), m_Value(Scalar),
377 if (match(SrcVec, m_BinOp(BO)) && cheapToScalarize(SrcVec, IndexC)) {
387 if (match(SrcVec, m_Cmp(Pred, m_Value(X), m_Value(Y))) &&
824 if (!match(InsElt.getOperand(2), m_ConstantInt(IdxC)))
830 if (!match(Op0, m_InsertElement(m_Undef(), m_Specific(X), m_ZeroInt())))
859 if (!match(InsElt.getOperand(2), m_ConstantInt(IdxC)))
866 if (!match(Scalar, m_ExtractElement(m_Specific(X), m_SpecificInt(IdxC))))
915 if (match(InsElt1->getOperand(0), m_Value(X)) &&
916 match(InsElt1->getOperand(1), m_Value(Y)) && !isa<Constant>(Y) &&
917 match(InsElt1->getOperand(2), m_ConstantInt(IdxC1)) &&
918 match(InsElt2.getOperand(1), m_Constant(ScalarC)) &&
919 match(InsElt2.getOperand(2), m_ConstantInt(IdxC2)) && IdxC1 != IdxC2) {
940 if (!match(Shuf->getOperand(1), m_Constant(ShufConstVec)) ||
941 !match(InsElt.getOperand(1), m_Constant(InsEltScalar)) ||
942 !match(InsElt.getOperand(2), m_ConstantInt(InsEltIndex)))
989 if (!match(InsElt.getOperand(2), m_ConstantInt(InsertIdx[0])) ||
990 !match(InsElt.getOperand(1), m_Constant(Val[0])) ||
991 !match(IEI->getOperand(2), m_ConstantInt(InsertIdx[1])) ||
992 !match(IEI->getOperand(1), m_Constant(Val[1])))
1038 if (match(VecOp, m_BitCast(m_Value(VecSrc))) &&
1039 match(ScalarOp, m_BitCast(m_Value(ScalarSrc))) &&
1053 if (match(IdxOp, m_ConstantInt(InsertedIdx)) &&
1054 match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp),
1450 if (match(BO1, m_Constant(C))) {
1459 if (match(BO1, m_APInt(C)) && MaskedValueIsZero(BO0, *C, DL))
1477 if (match(Op0, m_BinOp(m_Specific(Op1), m_Constant(C))))
1479 else if (match(Op1, m_BinOp(m_Specific(Op0), m_Constant(C))))
1533 if (!match(Op0, m_OneUse(m_InsertElement(m_Undef(), m_Value(X),
1535 !match(Op1, m_Undef()) || match(Mask, m_ZeroInt()) || IndexC == 0)
1535 !match(Op1, m_Undef()) || match(Mask, m_ZeroInt()) || IndexC == 0)
1576 if (!match(Shuf.getOperand(0), m_BinOp(B0)) ||
1577 !match(Shuf.getOperand(1), m_BinOp(B1)))
1583 if (match(B0, m_BinOp(m_Value(X), m_Constant(C0))) &&
1584 match(B1, m_BinOp(m_Value(Y), m_Constant(C1))))
1586 else if (match(B0, m_BinOp(m_Constant(C0), m_Value(X))) &&
1587 match(B1, m_BinOp(m_Constant(C1), m_Value(Y))))
1688 if (!match(Shuf.getOperand(1), m_Undef()) || !Shuf.isIdentityWithExtract())
1694 if (!match(Shuf.getOperand(0),
1702 if (!match(Cond, m_OneUse(m_ShuffleVector(m_Value(NarrowCond), m_Undef(),
1724 if (!match(Op0, m_ShuffleVector(m_Value(X), m_Value(Y), m_Constant(Mask))))
1771 if (!match(V0, m_InsertElement(m_Value(), m_Value(Scalar),
lib/Transforms/InstCombine/InstructionCombining.cpp 214 if (!match(B, m_APInt(BVal)) || !match(C, m_APInt(CVal)))
214 if (!match(B, m_APInt(BVal)) || !match(C, m_APInt(CVal)))
275 if (!match(BinOp1->getOperand(1), m_Constant(C1)) ||
276 !match(BinOp2->getOperand(1), m_Constant(C2)))
436 match(Op0, m_OneUse(m_BinOp(m_Value(A), m_Constant(C1)))) &&
437 match(Op1, m_OneUse(m_BinOp(m_Value(B), m_Constant(C2))))) {
529 if (match(Op, m_Shl(m_Value(), m_Constant(C)))) {
627 if (match(V, m_APInt(CInt))) {
767 if (match(LHS, m_Select(m_Value(A), m_Value(B), m_Value(C))) &&
768 match(RHS, m_Select(m_Specific(A), m_Value(D), m_Value(E)))) {
798 if (match(V, m_Neg(m_Value(NegV))))
1168 if (match(Val, m_Zero()) || Scale == 1) {
1344 if (match(Op, m_Zero())) {
1416 if (match(LHS, m_ShuffleVector(m_Value(L0), m_Value(L1), m_Constant(Mask))) &&
1417 match(RHS, m_ShuffleVector(m_Value(R0), m_Value(R1), m_Specific(Mask))) &&
1451 if (match(LHS, m_ShuffleVector(m_Value(V1), m_Undef(), m_Constant(Mask))) &&
1452 match(RHS, m_ShuffleVector(m_Value(V2), m_Undef(), m_Specific(Mask))) &&
1462 match(LHS, m_ShuffleVector(m_Value(V1), m_Value(V2), m_Constant(Mask))) &&
1463 match(RHS, m_ShuffleVector(m_Specific(V2), m_Specific(V1),
1489 if (match(&Inst, m_c_BinOp(
1575 bool IsSext = match(Op0, m_SExt(m_Value(X)));
1576 if (!IsSext && !match(Op0, m_ZExt(m_Value(X))))
1583 if (!(match(Op1, m_ZExtOrSExt(m_Value(Y))) && X->getType() == Y->getType() &&
1589 if (!Op0->hasOneUse() || !match(Op1, m_Constant(WideC)))
1670 if (!isa<Constant>(*I) || !match(I->get(), m_Zero())) {
1925 } else if (match(GEP.getOperand(1),
1929 } else if (match(GEP.getOperand(1),
1940 if (match(V, m_Neg(m_PtrToInt(m_Value())))) {
1949 if (match(V, m_Sub(m_PtrToInt(m_Value(Y)),
2462 if (!match(FreeInstrBBTerminator, m_UnconditionalBr(SuccBB)))
2482 if (!match(TI, m_Br(m_ICmp(Pred,
2560 if (match(&BI, m_Br(m_Not(m_Value(X)), m_BasicBlock(), m_BasicBlock())) &&
2578 if (match(&BI, m_Br(m_OneUse(m_Cmp(Pred, m_Value(), m_Value())),
2596 if (match(Cond, m_Add(m_Value(Op0), m_ConstantInt(AddRHS)))) {
3521 if (match(I, m_Intrinsic<Intrinsic::assume>()))
lib/Transforms/Scalar/CallSiteSplitting.cpp 138 if (!match(Cond, m_ICmp(Pred, m_Value(), m_Constant())))
lib/Transforms/Scalar/DivRemPairs.cpp 52 if (!match(&I, m_Sub(m_Value(Dividend), m_Value(XroundedDownToMultipleOfY))))
58 if (!match(
lib/Transforms/Scalar/EarlyCSE.cpp 144 if (!match(V, m_Select(m_Value(Cond), m_Value(A), m_Value(B))))
149 if (match(Cond, m_Not(m_Value(CondNot)))) {
218 if (!match(Cond, m_Cmp(Pred, m_Value(X), m_Value(Y))))
344 if (match(CondL, m_Cmp(PredL, m_Value(X), m_Value(Y))) &&
345 match(CondR, m_Cmp(PredR, m_Specific(X), m_Specific(Y))) &&
922 if (match(Inst, m_Intrinsic<Intrinsic::assume>())) {
935 if (match(Inst, m_Intrinsic<Intrinsic::sideeffect>())) {
953 if (match(Inst, m_Intrinsic<Intrinsic::invariant_start>())) {
lib/Transforms/Scalar/GVN.cpp 1864 if ((isKnownTrue && match(LHS, m_And(m_Value(A), m_Value(B)))) ||
1865 (isKnownFalse && match(LHS, m_Or(m_Value(A), m_Value(B))))) {
lib/Transforms/Scalar/GuardWidening.cpp 543 if (match(Cond0, m_ICmp(Pred0, m_Value(LHS), m_ConstantInt(RHS0))) &&
544 match(Cond1, m_ICmp(Pred1, m_Specific(LHS), m_ConstantInt(RHS1)))) {
625 if (match(CheckCond, m_And(m_Value(AndLHS), m_Value(AndRHS))))
666 if (match(Check.getBase(), m_Add(m_Value(OpLHS), m_ConstantInt(OpRHS)))) {
671 } else if (match(Check.getBase(),
lib/Transforms/Scalar/IndVarSimplify.cpp 1826 if (!match(NarrowDef, m_NSWAdd(m_Value(NarrowDefLHS),
1835 if (!match(Condition, m_ICmp(Pred, m_Specific(NarrowDefLHS),
1858 if (match(&I, m_Intrinsic<Intrinsic::experimental_guard>(m_Value(C))))
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp 296 if (match(RHS, m_ConstantInt<0>())) {
307 if (match(RHS, m_ConstantInt<-1>())) {
344 if (match(Condition, m_And(m_Value(), m_Value()))) {
lib/Transforms/Scalar/JumpThreading.cpp 858 match(CmpLHS, m_Add(m_Value(AddLHS), m_ConstantInt(AddConst)))) {
lib/Transforms/Scalar/LICM.cpp 894 match(&I, m_Intrinsic<Intrinsic::invariant_start>());
1141 if (match(CI, m_Intrinsic<Intrinsic::assume>()))
lib/Transforms/Scalar/LoopDeletion.cpp 108 if (!match(Pred->getTerminator(),
lib/Transforms/Scalar/LoopIdiomRecognize.cpp 1914 if (!match(CurLoop->getHeader()->getTerminator(),
1918 !match(CurLoop->getLoopLatch()->getTerminator(),
1941 if (!match(BCmpValue,
lib/Transforms/Scalar/LoopPredication.cpp 747 if (match(Condition, m_And(m_Value(LHS), m_Value(RHS)))) {
753 if (match(Condition,
lib/Transforms/Scalar/LowerConstantIntrinsics.cpp 63 if (match(BI->getOperand(0), m_Zero())) {
66 } else if (match(BI->getOperand(0), m_One())) {
lib/Transforms/Scalar/LowerWidenableCondition.cpp 53 if (match(&I, m_Intrinsic<Intrinsic::experimental_widenable_condition>()))
lib/Transforms/Scalar/NaryReassociate.cpp 500 return match(V, m_Add(m_Value(Op1), m_Value(Op2)));
502 return match(V, m_Mul(m_Value(Op1), m_Value(Op2)));
lib/Transforms/Scalar/NewGVN.cpp 2474 if (match(TI, m_Br(m_Value(Cond), TrueSucc, FalseSucc))) {
lib/Transforms/Scalar/Reassociate.cpp 128 if (match(V0, m_APInt(C)))
131 if (match(V1, m_APInt(C))) {
209 if (!match(I, m_Not(m_Value())) && !match(I, m_Neg(m_Value())) &&
209 if (!match(I, m_Not(m_Value())) && !match(I, m_Neg(m_Value())) &&
210 !match(I, m_FNeg(m_Value())))
582 if ((Opcode == Instruction::Mul && match(Tmp, m_Neg(m_Value()))) ||
583 (Opcode == Instruction::FMul && match(Tmp, m_FNeg(m_Value())))) {
857 if (!match(U, m_Neg(m_Value())) && !match(U, m_FNeg(m_Value())))
857 if (!match(U, m_Neg(m_Value())) && !match(U, m_FNeg(m_Value())))
924 if (match(Sub, m_Neg(m_Value())) || match(Sub, m_FNeg(m_Value())))
924 if (match(Sub, m_Neg(m_Value())) || match(Sub, m_FNeg(m_Value())))
1139 if (match(Ops[i].Op, m_Not(m_Value(X)))) { // Cannot occur for ^.
1329 if (match(V, m_APInt(C))) {
1485 if (!match(TheOp, m_Neg(m_Value(X))) && !match(TheOp, m_Not(m_Value(X))) &&
1485 if (!match(TheOp, m_Neg(m_Value(X))) && !match(TheOp, m_Not(m_Value(X))) &&
1486 !match(TheOp, m_FNeg(m_Value(X))))
1495 (match(TheOp, m_Neg(m_Value())) || match(TheOp, m_FNeg(m_Value()))))
1495 (match(TheOp, m_Neg(m_Value())) || match(TheOp, m_FNeg(m_Value()))))
1499 if (Ops.size() == 2 && match(TheOp, m_Not(m_Value())))
1513 if (match(TheOp, m_Not(m_Value()))) {
1949 if (!match(V, m_OneUse(m_Instruction(I))))
1958 if (match(I->getOperand(0), m_Constant()))
1961 if (match(I->getOperand(1), m_APFloat(C)) && C->isNegative()) {
1970 if (match(I->getOperand(0), m_Constant()) &&
1971 match(I->getOperand(1), m_Constant()))
1974 if ((match(I->getOperand(0), m_APFloat(C)) && C->isNegative()) ||
1975 (match(I->getOperand(1), m_APFloat(C)) && C->isNegative())) {
2013 if (match(Negatible->getOperand(0), m_APFloat(C))) {
2014 assert(!match(Negatible->getOperand(1), m_Constant()) &&
2020 if (match(Negatible->getOperand(1), m_APFloat(C))) {
2021 assert(!match(Negatible->getOperand(0), m_Constant()) &&
2057 if (match(I, m_FAdd(m_Value(X), m_OneUse(m_Instruction(Op)))))
2060 if (match(I, m_FAdd(m_OneUse(m_Instruction(Op)), m_Value(X))))
2063 if (match(I, m_FSub(m_Value(X), m_OneUse(m_Instruction(Op)))))
2120 } else if (match(I, m_Neg(m_Value()))) {
2145 } else if (match(I, m_FNeg(m_Value()))) {
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp 1171 if (match(I, m_Add(m_SExt(m_Value(LHS)), m_SExt(m_Value(RHS)))) ||
1172 match(I, m_Sub(m_SExt(m_Value(LHS)), m_SExt(m_Value(RHS))))) {
1187 if (match(I, m_NSWAdd(m_Value(LHS), m_Value(RHS))) ||
1188 match(I, m_NSWSub(m_Value(LHS), m_Value(RHS)))) {
lib/Transforms/Scalar/StraightLineStrengthReduce.cpp 403 if (match(RHS, m_Mul(m_Value(S), m_ConstantInt(Idx)))) {
406 } else if (match(RHS, m_Shl(m_Value(S), m_ConstantInt(Idx)))) {
421 return (match(A, m_Add(m_Value(B), m_ConstantInt(C))) ||
422 match(A, m_Add(m_ConstantInt(C), m_Value(B))));
427 return (match(A, m_Or(m_Value(B), m_ConstantInt(C))) ||
428 match(A, m_Or(m_ConstantInt(C), m_Value(B))));
503 if (match(ArrayIdx, m_NSWMul(m_Value(LHS), m_ConstantInt(RHS)))) {
507 } else if (match(ArrayIdx, m_NSWShl(m_Value(LHS), m_ConstantInt(RHS)))) {
550 if (match(ArrayIdx, m_SExt(m_Value(TruncatedArrayIdx))) &&
645 if (match(Bump, m_Neg(m_Value(NegBump)))) {
lib/Transforms/Scalar/StructurizeCFG.cpp 410 if (match(Condition, m_Not(m_Value(NotCondition))))
418 if (I->getParent() == Parent && match(I, m_Not(m_Specific(Condition))))
lib/Transforms/Utils/CodeExtractor.cpp 1413 if (match(&I, m_Intrinsic<Intrinsic::assume>()))
lib/Transforms/Utils/Local.cpp 2037 if (match(CI->getArgOperand(0), m_CombineOr(m_Zero(), m_Undef()))) {
2053 if (match(CI->getArgOperand(0), m_Zero()))
lib/Transforms/Utils/LoopUnrollPeel.cpp 189 if (!match(Condition, m_ICmp(Pred, m_Value(LeftVal), m_Value(RightVal))))
lib/Transforms/Utils/PredicateInfo.cpp 424 if (match(BI->getCondition(), m_And(m_Cmp(Pred, m_Value(), m_Value()),
426 match(BI->getCondition(), m_Or(m_Cmp(Pred, m_Value(), m_Value()),
lib/Transforms/Utils/SimplifyCFG.cpp 546 if (match(ICI->getOperand(0),
569 if (match(ICI->getOperand(0),
601 if (match(I->getOperand(0), m_Add(m_Value(RHSVal), m_APInt(RHSC)))) {
2354 if (!match(V0, m_Not(m_Value())))
2357 return match(V0, m_Not(m_Value())) && match(V1, Invertible);
2357 return match(V0, m_Not(m_Value())) && match(V1, Invertible);
lib/Transforms/Utils/SimplifyIndVar.cpp 773 if (match(U,
775 match(U,
lib/Transforms/Utils/SimplifyLibCalls.cpp 244 if (match(Size, m_Select(m_Value(), m_APInt(X), m_APInt(Y)))) {
1369 if (match(Call->getArgOperand(0), m_OneUse(m_FNeg(m_Value(X)))))
1376 if (match(Call->getArgOperand(0), m_FNeg(m_Value(X))))
1503 if (!match(Pow->getArgOperand(0), m_APFloat(BaseF)))
1507 if (match(Base, m_SpecificFP(2.0)) &&
1541 if (match(Base, m_SpecificFP(10.0)) &&
1598 if (!match(Expo, m_APFloat(ExpoF)) ||
1663 if (match(Base, m_FPOne()))
1672 if (match(Expo, m_SpecificFP(-1.0)))
1676 if (match(Expo, m_AnyZeroFP()))
1680 if (match(Expo, m_FPOne()))
1684 if (match(Expo, m_SpecificFP(2.0)))
1692 if (AllowApprox && match(Expo, m_APFloat(ExpoF))) {
1997 if (match(Op0, m_FMul(m_Value(OtherMul0), m_Value(OtherMul1)))) {
lib/Transforms/Vectorize/SLPVectorizer.cpp 3307 while (match(ZextLoad, m_Or(m_Value(), m_Value())) ||
3308 match(ZextLoad, m_Shl(m_Value(), m_Constant())))
3313 if (!match(ZextLoad, m_ZExt(m_Load(m_Value(LoadPtr)))))
6185 if (match(Cond, m_Cmp(Pred, m_Specific(LHS), m_Instruction(L2)))) {
6189 } else if (match(Cond, m_Cmp(Pred, m_Instruction(L1), m_Specific(RHS)))) {
6196 if (!match(Cond, m_Cmp(Pred, m_Instruction(L1), m_Instruction(L2))) ||
unittests/IR/PatternMatch.cpp 536 EXPECT_TRUE(match(X, m_Deferred(tX)));
537 EXPECT_FALSE(match(Y, m_Deferred(tX)));
541 EXPECT_TRUE(match(X, m_Deferred(tX)));
542 EXPECT_FALSE(match(Y, m_Deferred(tX)));
546 EXPECT_TRUE(match(X, m_Deferred(tX)));
547 EXPECT_FALSE(match(Y, m_Deferred(tX)));
551 EXPECT_TRUE(match(X, m_Deferred(tX)));
552 EXPECT_FALSE(match(Y, m_Deferred(tX)));
557 EXPECT_TRUE(match(IRB.CreateAnd(X, X), m_And(m_Value(tX), m_Deferred(tX))));
563 match(IRB.CreateAnd(X, Y), m_c_And(m_Value(tX), m_Deferred(tX))));
568 EXPECT_TRUE(match(
942 EXPECT_TRUE(match(VI1, m_InsertElement(m_Value(), m_Value(), m_Value())));
944 match(VI1, m_InsertElement(m_Undef(), m_ConstantInt(), m_ConstantInt())));
946 match(VI1, m_InsertElement(m_Undef(), m_ConstantInt(), m_Zero())));
948 match(VI1, m_InsertElement(m_Undef(), m_SpecificInt(1), m_Zero())));
949 EXPECT_TRUE(match(VI2, m_InsertElement(m_Value(), m_Value(), m_Value())));
951 match(VI2, m_InsertElement(m_Value(), m_Value(), m_ConstantInt())));
953 match(VI2, m_InsertElement(m_Value(), m_ConstantInt(), m_Value())));
954 EXPECT_FALSE(match(VI2, m_InsertElement(m_Constant(), m_Value(), m_Value())));
955 EXPECT_TRUE(match(VI3, m_InsertElement(m_Value(A), m_Value(B), m_Value(C))));
962 EXPECT_TRUE(match(EX1, m_ExtractElement(m_Value(A), m_Value(B))));
966 EXPECT_FALSE(match(EX1, m_ExtractElement(m_Value(), m_ConstantInt())));
967 EXPECT_TRUE(match(EX2, m_ExtractElement(m_Value(), m_ConstantInt())));
968 EXPECT_TRUE(match(EX3, m_ExtractElement(m_Constant(), m_ConstantInt())));
971 EXPECT_TRUE(match(SI1, m_ShuffleVector(m_Value(), m_Undef(), m_Zero())));
972 EXPECT_TRUE(match(SI2, m_ShuffleVector(m_Value(A), m_Value(B), m_Value(C))));
979 EXPECT_TRUE(match(
983 EXPECT_FALSE(match(
986 EXPECT_FALSE(match(
989 EXPECT_TRUE(match(
993 EXPECT_TRUE(match(
1014 EXPECT_TRUE(match(ScalarUndef, m_Undef()));
1015 EXPECT_TRUE(match(VectorUndef, m_Undef()));
1016 EXPECT_FALSE(match(ScalarZero, m_Undef()));
1017 EXPECT_FALSE(match(VectorZero, m_Undef()));
1018 EXPECT_FALSE(match(VectorZeroUndef, m_Undef()));
1020 EXPECT_FALSE(match(ScalarUndef, m_Zero()));
1021 EXPECT_FALSE(match(VectorUndef, m_Zero()));
1022 EXPECT_TRUE(match(ScalarZero, m_Zero()));
1023 EXPECT_TRUE(match(VectorZero, m_Zero()));
1024 EXPECT_TRUE(match(VectorZeroUndef, m_Zero()));
1042 EXPECT_TRUE(match(ScalarUndef, m_Undef()));
1043 EXPECT_TRUE(match(VectorUndef, m_Undef()));
1044 EXPECT_FALSE(match(ScalarZero, m_Undef()));
1045 EXPECT_FALSE(match(VectorZero, m_Undef()));
1046 EXPECT_FALSE(match(VectorZeroUndef, m_Undef()));
1048 EXPECT_FALSE(match(ScalarUndef, m_AnyZeroFP()));
1049 EXPECT_FALSE(match(VectorUndef, m_AnyZeroFP()));
1050 EXPECT_TRUE(match(ScalarZero, m_AnyZeroFP()));
1051 EXPECT_TRUE(match(VectorZero, m_AnyZeroFP()));
1052 EXPECT_TRUE(match(VectorZeroUndef, m_AnyZeroFP()));
1067 EXPECT_TRUE(match(V, m_FNeg(m_Value(Match))));
1071 EXPECT_TRUE(match(V1, m_FNeg(m_Value(Match))));
1075 EXPECT_FALSE(match(V2, m_FNeg(m_Value(Match))));
1077 EXPECT_TRUE(match(V2, m_FNeg(m_Value(Match))));
1081 EXPECT_FALSE(match(V3, m_FNeg(m_Value(Match))));
1089 EXPECT_TRUE(match(Br1, m_Br(m_Value(), m_BasicBlock(), m_BasicBlock())));
1092 EXPECT_TRUE(match(Br1, m_Br(m_Value(), m_BasicBlock(A), m_BasicBlock(B))));
1097 match(Br1, m_Br(m_Value(), m_SpecificBB(FalseBB), m_BasicBlock())));
1099 match(Br1, m_Br(m_Value(), m_BasicBlock(), m_SpecificBB(TrueBB))));
1101 match(Br1, m_Br(m_Value(), m_SpecificBB(FalseBB), m_BasicBlock(TrueBB))));
1103 match(Br1, m_Br(m_Value(), m_SpecificBB(TrueBB), m_BasicBlock(FalseBB))));
1106 EXPECT_FALSE(match(Br1, m_Br(m_Value(), m_BasicBlock(A), m_Deferred(A))));
1109 EXPECT_TRUE(match(Br2, m_Br(m_Value(), m_BasicBlock(A), m_Deferred(A))));