Lines Matching defs:Op1

701   auto NewICmp = [Cond](GEPNoWrapFlags NW, Value *Op1, Value *Op2) {
704 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Op1, Op2);
707 auto *I = new ICmpInst(Cond, Op1, Op2);
1319 Value *Op0 = Cmp.getOperand(0), *Op1 = Cmp.getOperand(1);
1322 if (Pred == ICmpInst::ICMP_UGT && match(Op1, m_ConstantInt(CI)) &&
1328 Constant *C = dyn_cast<Constant>(Op1);
3056 Value *Op1, IRBuilderBase &Builder,
3070 return HasOneUse ? Builder.CreateNot(Builder.CreateOr(Op0, Op1)) : nullptr;
3072 return HasOneUse ? Builder.CreateAnd(Builder.CreateNot(Op0), Op1) : nullptr;
3076 return HasOneUse ? Builder.CreateAnd(Op0, Builder.CreateNot(Op1)) : nullptr;
3078 return Builder.CreateNot(Op1);
3080 return Builder.CreateXor(Op0, Op1);
3082 return HasOneUse ? Builder.CreateNot(Builder.CreateAnd(Op0, Op1)) : nullptr;
3084 return Builder.CreateAnd(Op0, Op1);
3086 return HasOneUse ? Builder.CreateNot(Builder.CreateXor(Op0, Op1)) : nullptr;
3088 return Op1;
3090 return HasOneUse ? Builder.CreateOr(Builder.CreateNot(Op0), Op1) : nullptr;
3094 return HasOneUse ? Builder.CreateOr(Op0, Builder.CreateNot(Op1)) : nullptr;
3096 return Builder.CreateOr(Op0, Op1);
3112 Value *Op0, *Op1;
3118 m_ZExtOrSExt(m_Value(Op1))))) &&
3120 Op1->getType()->isIntOrIntVectorTy(1)) {
3137 createLogicFromTable(Table, Op0, Op1, Builder, Add->hasOneUse()))
3380 Value *Op1 = Cmp.getOperand(1);
3398 match(Op1, m_Zero()))
3402 if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One()))
3406 if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))
3415 if (Cmp.isEquality() && match(Op1, m_Zero()))
3420 if (match(Op1, m_APInt(C)) && Bitcast->hasOneUse()) {
3883 Value *Op1 = Cmp.getOperand(1);
3885 const auto *IIOp1 = dyn_cast<IntrinsicInst>(Op1);
4035 Value *Op1 = II->getOperand(1);
4040 if (!match(Op1, m_APInt(COp1)))
4093 Builder.CreateAdd(Op0, ConstantInt::get(Op1->getType(), EquivOffset)),
4094 ConstantInt::get(Op1->getType(), EquivInt));
4263 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
4264 Constant *RHSC = dyn_cast<Constant>(Op1);
4311 Value *Op1 = SimplifyOp(SI->getOperand(1), true);
4312 if (Op1)
4313 CI = dyn_cast<ConstantInt>(Op1);
4335 if (Op1 && Op2)
4337 else if (Simplifies(Op1, 1) || Simplifies(Op2, 2)) {
4343 // When Op1 is constant try replacing select with second operand.
4346 Transform = replacedSelectWithOperand(SI, &I, Op1 ? 2 : 1);
4349 if (!Op1)
4350 Op1 = Builder.CreateICmp(Pred, SI->getOperand(1), RHS, I.getName());
4353 return SelectInst::Create(SI->getOperand(0), Op1, Op2);
4468 Value *Op1, const SimplifyQuery &Q,
4528 if (match(Op0, m_c_And(m_Specific(Op1), m_Value(M)))) {
4529 X = Op1;
4542 if (ICmpInst::isEquality(Pred) && match(Op1, m_AllOnes()) &&
4561 if (ICmpInst::isEquality(Pred) && match(Op1, m_Zero()) &&
4947 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1), *A;
4950 if (match(Op1, m_c_And(m_Specific(Op0), m_Value()))) {
4951 std::swap(Op0, Op1);
4955 if (!match(Op0, m_c_And(m_Specific(Op1), m_Value(A))))
4960 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
4964 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
4970 if (!match(Op1, m_ImmConstant()))
4972 IC.getFreelyInverted(Op1, !Op1->hasNUsesOrMore(3), &IC.Builder))
4974 Constant::getAllOnesValue(Op1->getType()));
4977 return new ICmpInst(Pred, IC.Builder.CreateAnd(Op1, NotA),
4978 Constant::getNullValue(Op1->getType()));
4987 return new ICmpInst(ICmpInst::getUnsignedPredicate(Pred), Op0, Op1);
4995 return new ICmpInst(ICmpInst::getSwappedPredicate(Pred), Op1,
4996 Constant::getNullValue(Op1->getType()));
4998 if (isKnownNegative(Op1, IC.getSimplifyQuery().getWithInstruction(&I)))
5009 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1), *A;
5013 if (match(Op1, m_c_Or(m_Specific(Op0), m_Value(A)))) {
5014 std::swap(Op0, Op1);
5016 } else if (!match(Op0, m_c_Or(m_Specific(Op1), m_Value(A)))) {
5022 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5026 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5031 IC.getFreelyInverted(Op1, !Op1->hasNUsesOrMore(3), &IC.Builder))
5033 Constant::getNullValue(Op1->getType()));
5036 return new ICmpInst(Pred, IC.Builder.CreateOr(Op1, NotA),
5037 Constant::getAllOnesValue(Op1->getType()));
5044 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1), *A;
5047 if (match(Op1, m_c_Xor(m_Specific(Op0), m_Value()))) {
5048 std::swap(Op0, Op1);
5051 if (!match(Op0, m_c_Xor(m_Specific(Op1), m_Value(A))))
5060 return new ICmpInst(PredOut, Op0, Op1);
5072 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
5076 BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1);
5087 // (Op1 + X) u</u>= Op1 --> ~Op1 u</u>= X
5088 if (match(Op0, m_OneUse(m_c_Add(m_Specific(Op1), m_Value(X)))) &&
5090 return new ICmpInst(Pred, Builder.CreateNot(Op1), X);
5092 if (match(Op1, m_OneUse(m_c_Add(m_Specific(Op0), m_Value(X)))) &&
5097 // (Op1 + X) + C u</u>= Op1 --> ~C - X u</u>= Op1
5099 if (match(Op0, m_OneUse(m_Add(m_c_Add(m_Specific(Op1), m_Value(X)),
5103 return new ICmpInst(Pred, Builder.CreateSub(C2, X), Op1);
5106 if (match(Op1, m_OneUse(m_Add(m_c_Add(m_Specific(Op0), m_Value(X)),
5128 // ((Op1 + C) & C) u< Op1 --> Op1 != 0
5129 // ((Op1 + C) & C) u>= Op1 --> Op1 == 0
5136 match(BO, m_Add(m_Specific(Op1), m_SpecificIntAllowPoison(*C)))) {
5139 Constant *Zero = ConstantInt::getNullValue(Op1->getType());
5140 return new ICmpInst(NewPred, Op1, Zero);
5144 match(Op1, m_And(m_BinOp(BO), m_LowBitMask(C))) &&
5148 Constant *Zero = ConstantInt::getNullValue(Op1->getType());
5156 // Analyze the case when either Op0 or Op1 is an add instruction.
5157 // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
5187 if ((A == Op1 || B == Op1) && NoOp0WrapProblem)
5188 return new ICmpInst(Pred, A == Op1 ? B : A,
5189 Constant::getNullValue(Op1->getType()));
5223 // icmp slt (A + -1), Op1 -> icmp sle A, Op1
5226 return new ICmpInst(CmpInst::ICMP_SLE, A, Op1);
5228 // icmp sge (A + -1), Op1 -> icmp sgt A, Op1
5231 return new ICmpInst(CmpInst::ICMP_SGT, A, Op1);
5233 // icmp sle (A + 1), Op1 -> icmp slt A, Op1
5235 return new ICmpInst(CmpInst::ICMP_SLT, A, Op1);
5237 // icmp sgt (A + 1), Op1 -> icmp sge A, Op1
5239 return new ICmpInst(CmpInst::ICMP_SGE, A, Op1);
5263 // icmp ult (A - 1), Op1 -> icmp ule A, Op1
5264 // icmp uge (A - 1), Op1 -> icmp ugt A, Op1
5268 // icmp ule (A + 1), Op0 -> icmp ult A, Op1
5270 return new ICmpInst(CmpInst::ICMP_ULT, A, Op1);
5272 // icmp ugt (A + 1), Op0 -> icmp uge A, Op1
5274 return new ICmpInst(CmpInst::ICMP_UGE, A, Op1);
5324 // Analyze the case when either Op0 or Op1 is a sub instruction.
5325 // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).
5340 if (A == Op1 && NoOp0WrapProblem)
5341 return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B);
5348 if (A == Op1 && (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE))
5354 if (A == Op1 && (Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) &&
5374 if (Constant *RHSC = dyn_cast<Constant>(Op1))
5390 match(Op1, m_c_Mul(m_Specific(Z), m_Value(Y)))) ||
5392 match(Op1, m_c_Mul(m_Specific(Z), m_Value(Y))))) {
5441 if (BO0 && BO0->getOpcode() == Instruction::SRem && Op1 == BO0->getOperand(1))
5548 auto LSubOne = m_Add(m_Specific(Op1), m_AllOnes());
5553 return new ICmpInst(ICmpInst::ICMP_NE, Op1, Zero);
5561 if (match(Op0, m_Shl(m_Specific(Op1), m_One())))
5562 return new ICmpInst(ICmpInst::getSignedPredicate(Pred), Op1,
5563 Constant::getNullValue(Op1->getType()));
5564 else if (match(Op1, m_Shl(m_Specific(Op0), m_One())))
5728 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
5737 !match(Op1, m_ZeroInt()))
5742 if (match(Op0, m_OneUse(m_c_And(m_Neg(m_Specific(Op1)), m_Specific(Op1)))))
5743 A = Op1;
5744 else if (match(Op1,
5754 match(Op0, m_OneUse(m_c_Xor(m_Add(m_Specific(Op1), m_AllOnes()),
5755 m_Specific(Op1))))) {
5756 A = Op1;
5759 match(Op1, m_OneUse(m_c_Xor(m_Add(m_Specific(Op0), m_AllOnes()),
5782 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
5786 if (A == Op1 || B == Op1) { // (A^B) == A -> B == 0
5787 Value *OtherVal = A == Op1 ? B : A;
5791 if (match(Op1, m_Xor(m_Value(C), m_Value(D)))) {
5795 Op1->hasOneUse()) {
5813 if (match(Op1, m_Xor(m_Value(A), m_Value(B))) && (A == Op0 || B == Op0)) {
5821 match(Op1, m_And(m_Value(C), m_Value(D)))) {
5850 // If either Op0/Op1 are both one use or X^Y will constant fold and one of
5851 // Op0/Op1 are one use, proceed. In those cases we are instruction neutral
5854 int(Op0->hasOneUse()) + int(Op1->hasOneUse()) +
5858 Op1 = Builder.CreateXor(X, Y);
5859 Op1 = Builder.CreateAnd(Op1, Z);
5860 return new ICmpInst(Pred, Op1, Constant::getNullValue(Op1->getType()));
5871 match(Op1, m_OneUse(m_Or(m_Value(Y), m_Specific(C))))) {
5878 if (match(Op1, m_ZExt(m_Value(A))) &&
5879 (Op0->hasOneUse() || Op1->hasOneUse())) {
5892 match(Op1, m_OneUse(m_LShr(m_Value(B), m_APIntAllowPoison(AP2))))) ||
5894 match(Op1, m_OneUse(m_AShr(m_Value(B), m_APIntAllowPoison(AP2)))))) {
5911 match(Op1, m_OneUse(m_Shl(m_Value(B), m_Specific(Cst1))))) {
5928 match(Op1, m_ConstantInt(Cst1)) &&
5956 match(Op1, m_Trunc(m_LShr(m_Specific(A), m_SpecificInt(BitWidth)))) &&
5970 if (match(Op0, m_c_And(m_Specific(Op1), m_Value())) &&
5971 isKnownToBeAPowerOfTwo(Op1, /* OrZero */ false, 0, &I))
5975 if (match(Op1, m_c_And(m_Specific(Op0), m_Value())) &&
5977 return new ICmpInst(CmpInst::getInversePredicate(Pred), Op1,
5978 ConstantInt::getNullValue(Op1->getType()));
6029 Value *Op0 = ICmp.getOperand(0), *Op1 = ICmp.getOperand(1);
6035 if (!match(Op0, m_OneUse(m_Trunc(m_Value(X)))) || !match(Op1, m_APInt(C)))
6040 if (auto Res = decomposeBitTestICmp(Op0, Op1, Pred, /*WithTrunc=*/true,
6641 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
6672 Pred, ConstantExpr::getIntegerValue(Ty, Op0Known.getConstant()), Op1);
6673 if (!isa<Constant>(Op1) && Op1Known.isConstant())
6709 match(Op1, m_MaxOrMin(m_Value(), m_Value()));
6717 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
6719 if (match(Op1, m_APInt(CmpC))) {
6723 ConstantInt::get(Op1->getType(), *CmpC - 1));
6728 Constant::getNullValue(Op1->getType()));
6734 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
6736 if (match(Op1, m_APInt(CmpC))) {
6740 ConstantInt::get(Op1->getType(), *CmpC + 1));
6745 Constant::getNullValue(Op1->getType()));
6751 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
6753 if (match(Op1, m_APInt(CmpC))) {
6756 ConstantInt::get(Op1->getType(), *CmpC - 1));
6762 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
6764 if (match(Op1, m_APInt(CmpC))) {
6767 ConstantInt::get(Op1->getType(), *CmpC + 1));
6817 ConstantInt::getNullValue(Op1->getType()));
6822 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
6826 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
6830 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
6834 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
6950 Value *Op1 = I.getOperand(1);
6951 auto *Op1C = dyn_cast<Constant>(Op1);
7180 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
7187 ((Pred == ICmpInst::ICMP_ULT && (Op1 == A || Op1 == B)) ||
7188 (Pred == ICmpInst::ICMP_EQ && match(Op1, m_ZeroInt()) &&
7190 (Pred == ICmpInst::ICMP_NE && match(Op1, m_AllOnes()) &&
7196 else if (match(Op1, UAddOvResultPat) &&
7199 UAddOv = cast<ExtractValueInst>(Op1)->getAggregateOperand();
7274 Value *Op0, Value *Op1,
7278 if (Instruction *NI = foldGEPICmp(GEP, Op1, Pred, CxtI))
7282 if (Instruction *NI = foldSelectICmp(Pred, SI, Op1, CxtI))
7286 if (Instruction *Res = foldICmpWithMinMax(CxtI, MinMax, Op1, Pred))
7293 if (match(Op0, m_Add(m_Value(X), m_APInt(C))) && Op1 == X)
7311 match(Op1, m_Specific(X))) {
7349 if (Value *V = foldICmpWithLowBitMaskedVal(Pred, Op0, Op1, Q, *this))
7355 if (match(Op0, m_UDiv(m_Specific(Op1), m_CheckedInt(CheckUGT1)))) {
7356 return new ICmpInst(ICmpInst::getSwappedPredicate(Pred), Op1,
7357 Constant::getNullValue(Op1->getType()));
7361 match(Op0, m_SDiv(m_Specific(Op1), m_CheckedInt(CheckUGT1)))) {
7362 return new ICmpInst(ICmpInst::getSwappedPredicate(Pred), Op1,
7363 Constant::getNullValue(Op1->getType()));
7370 if (match(Op0, m_LShr(m_Specific(Op1), m_CheckedInt(CheckNE0)))) {
7371 return new ICmpInst(ICmpInst::getSwappedPredicate(Pred), Op1,
7372 Constant::getNullValue(Op1->getType()));
7376 match(Op0, m_AShr(m_Specific(Op1), m_CheckedInt(CheckNE0)))) {
7377 return new ICmpInst(ICmpInst::getSwappedPredicate(Pred), Op1,
7378 Constant::getNullValue(Op1->getType()));
7388 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
7390 unsigned Op1Cplxity = getComplexity(Op1);
7397 std::swap(Op0, Op1);
7401 if (Value *V = simplifyICmpInst(I.getCmpPredicate(), Op0, Op1, Q))
7406 if (I.getPredicate() == ICmpInst::ICMP_NE && match(Op1, m_Zero())) {
7412 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
7416 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
7474 if (match(Op1, m_APInt(C))) {
7508 if (Instruction *Res = foldICmpCommutative(I.getCmpPredicate(), Op0, Op1, I))
7511 foldICmpCommutative(I.getSwappedCmpPredicate(), Op1, Op0, I))
7538 match(Op1, m_Select(m_Specific(Cond), m_Value(C), m_Value(D))) &&
7539 (Op0->hasOneUse() || Op1->hasOneUse())) {
7555 assert(Op1->getType()->isPointerTy() && "Comparing pointer with non-pointer?");
7559 if (auto *Alloca = dyn_cast<AllocaInst>(getUnderlyingObject(Op1)))
7577 match(Op1, m_Zero()) && isKnownToBeAPowerOfTwo(X, false, 0, &I) &&
7580 Op1);
7582 // Op0 pred Op1 -> ~Op1 pred ~Op0, if this allows us to drop an instruction.
7586 isFreeToInvert(Op1, Op1->hasOneUse(), ConsumesOp1) &&
7589 Value *InvOp1 = getFreelyInverted(Op1, Op1->hasOneUse(), &Builder);
7615 match(Op1, m_APInt(C))) {
7625 match(Op1,
7628 (Op0->hasOneUse() || Op1->hasOneUse())) {
7668 if (EVI->getIndices()[0] == 0 && ACXI->getCompareOperand() == Op1 &&
7693 match(Op1, m_APInt(C2))) {
8161 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
8163 // Canonicalize fneg as Op1.
8164 if (match(Op0, m_FNeg(m_Value())) && !match(Op1, m_FNeg(m_Value()))) {
8165 std::swap(Op0, Op1);
8169 if (!match(Op1, m_FNeg(m_Specific(Op0))))
8306 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
8307 if (Value *V = simplifyFCmpInst(Pred, Op0, Op1, I.getFastMathFlags(),
8313 assert(OpType == Op1->getType() && "fcmp with different-typed operands?");
8314 if (Op0 == Op1) {
8352 if (!match(Op1, m_PosZeroFP()) &&
8353 isKnownNeverNaN(Op1, 0, getSimplifyQuery().getWithInstruction(&I)))
8359 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
8382 if (match(Op1, m_AnyZeroFP()) && !match(Op1, m_PosZeroFP()))
8403 if (match(Op1, m_APFloat(C)) && C->isInfinity()) {
8415 return new FCmpInst(FCmpInst::FCMP_ONE, Op0, Op1, "", &I);
8420 return new FCmpInst(FCmpInst::FCMP_OEQ, Op0, Op1, "", &I);
8422 return new FCmpInst(FCmpInst::FCMP_UNE, Op0, Op1, "", &I);
8427 return new FCmpInst(FCmpInst::FCMP_UEQ, Op0, Op1, "", &I);
8433 if (match(Op1, m_PosZeroFP()) &&
8452 if (match(Op0, m_Instruction(LHSI)) && match(Op1, m_Constant(RHSC))) {
8502 if (match(Op1, m_Constant(C)))
8509 return new FCmpInst(Pred, X, Op1, "", &I);
8512 if (match(Op1, m_FAdd(m_Value(Y), m_AnyZeroFP())))
8517 if (match(Op1, m_FPExt(m_Value(Y))) && X->getType() == Y->getType())
8521 if (match(Op1, m_APFloat(C))) {
8571 match(Op1, m_AnyZeroFP()) && !C->isZero() && !C->isNaN()) {
8587 match(Op1, m_Intrinsic<Intrinsic::canonicalize>(m_Value(CanonRHS)));
8590 if (CanonLHS == Op1)
8591 return new FCmpInst(Pred, Op1, Op1, "", &I);