Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:Op0

2584 /// \brief Check if the order of \p Op0 and \p Op1 as operand in an ICmpInst
2591 /// \return true if Op0 and Op1 should be swapped.
2592 static bool swapMayExposeCSEOpportunities(const Value * Op0,
2596 if (Op0->getType()->isPointerTy())
2598 // Count every uses of both Op0 and Op1 in a subtract.
2599 // Each time Op0 is the first operand, count -1: swapping is bad, the
2601 // Each time Op0 is the second operand, count +1: swapping is good, the
2603 // At the end, if the benefit is greater than 0, Op0 should come second to
2606 for (const User *U : Op0->users()) {
2610 // If Op0 is the first argument, this is not beneficial to swap the
2614 if (BinOp->getOperand(Op1Idx) == Op0) {
2743 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
2744 unsigned Op0Cplxity = getComplexity(Op0);
2752 swapMayExposeCSEOpportunities(Op0, Op1))) {
2754 std::swap(Op0, Op1);
2759 SimplifyICmpInst(I.getPredicate(), Op0, Op1, DL, TLI, DT, AC, &I))
2767 if (match(Op0, m_Select(m_Value(Cond), m_Value(SelectTrue),
2780 Type *Ty = Op0->getType();
2787 Value *Xor = Builder->CreateXor(Op0, Op1, I.getName()+"tmp");
2791 return BinaryOperator::CreateXor(Op0, Op1);
2794 std::swap(Op0, Op1); // Change icmp ugt -> icmp ult
2797 Op0, I.getName()+"tmp");
2801 std::swap(Op0, Op1); // Change icmp sgt -> icmp slt
2805 return BinaryOperator::CreateAnd(Not, Op0);
2808 std::swap(Op0, Op1); // Change icmp uge -> icmp ule
2811 Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp");
2815 std::swap(Op0, Op1); // Change icmp sge -> icmp sle
2819 return BinaryOperator::CreateOr(Not, Op0);
2851 match(Op0, m_Add(m_Add(m_Value(A), m_Value(B)), m_ConstantInt(CI2))))
2858 if (Op0->hasOneUse()) {
2861 match(Op0, m_Sub(m_Value(A), m_Value(B))))
2866 match(Op0, m_NSWSub(m_Value(A), m_Value(B))))
2871 match(Op0, m_NSWSub(m_Value(A), m_Value(B))))
2876 match(Op0, m_NSWSub(m_Value(A), m_Value(B))))
2881 match(Op0, m_NSWSub(m_Value(A), m_Value(B))))
2893 return new ICmpInst(ICmpInst::ICMP_ULT, Op0,
2897 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
2901 return new ICmpInst(ICmpInst::ICMP_UGT, Op0,
2905 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
2911 if (match(Op0, m_AShr(m_ConstantInt(CI2), m_Value(A))) ||
2912 match(Op0, m_LShr(m_ConstantInt(CI2), m_Value(A)))) {
2914 if (Instruction *Inst = FoldICmpCstShrCst(I, Op0, A, CI, CI2))
2917 if (match(Op0, m_Shl(m_ConstantInt(CI2), m_Value(A)))) {
2919 if (Instruction *Inst = FoldICmpCstShlCst(I, Op0, A, CI, CI2))
2965 if (!isa<Constant>(Op0) && Op0Min == Op0Max)
2967 ConstantInt::get(Op0->getType(), Op0Min), Op1);
2969 return new ICmpInst(I.getPredicate(), Op0,
2988 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
2990 LHS = Op0;
3032 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
3034 LHS = Op0;
3070 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
3073 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
3078 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
3079 Constant::getAllOnesValue(Op0->getType()));
3089 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
3092 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
3097 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
3098 Constant::getNullValue(Op0->getType()));
3107 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
3110 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
3121 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
3124 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
3163 return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);
3175 if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
3176 (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
3185 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
3192 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
3280 if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op0))
3284 if (Instruction *NI = FoldGEPICmp(GEP, Op0,
3289 if (Op0->getType()->isPointerTy() && I.isEquality()) {
3291 if (auto *Alloca = dyn_cast<AllocaInst>(GetUnderlyingObject(Op0, DL)))
3295 if (Instruction *New = FoldAllocaCmp(I, Alloca, Op0))
3302 if (BitCastInst *CI = dyn_cast<BitCastInst>(Op0)) {
3303 if (Op0->getType()->isPointerTy() &&
3307 Op0 = CI->getOperand(0);
3315 if (Op0->getType() != Op1->getType()) {
3317 Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
3320 Op1 = Builder->CreateBitCast(Op1, Op0->getType());
3323 return new ICmpInst(I.getPredicate(), Op0, Op1);
3327 if (isa<CastInst>(Op0)) {
3340 BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);
3354 // Analyze the case when either Op0 or Op1 is an add instruction.
3355 // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
3374 if ((C == Op0 || D == Op0) && NoOp1WrapProblem)
3375 return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()),
3376 C == Op0 ? D : C);
3429 return new ICmpInst(CmpInst::ICMP_SGE, Op0, C);
3434 return new ICmpInst(CmpInst::ICMP_SLT, Op0, C);
3439 return new ICmpInst(CmpInst::ICMP_SGT, Op0, C);
3444 return new ICmpInst(CmpInst::ICMP_SLE, Op0, C);
3475 // Analyze the case when either Op0 or Op1 is a sub instruction.
3476 // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).
3488 if (C == Op0 && NoOp1WrapProblem)
3489 return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType()));
3520 Op0 == BO1->getOperand(1))
3633 if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&
3642 if (match(Op0, m_Not(m_Value(A)))) {
3663 if (match(Op0, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))) {
3664 if (Instruction *R = ProcessUMulZExtIdiom(I, Op0, Op1, *this))
3668 if (Instruction *R = ProcessUMulZExtIdiom(I, Op1, Op0, *this))
3676 if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) {
3702 (A == Op0 || B == Op0)) {
3704 Value *OtherVal = A == Op0 ? B : A;
3710 if (match(Op0, m_OneUse(m_And(m_Value(A), m_Value(B)))) &&
3736 if ((Op0->hasOneUse() &&
3737 match(Op0, m_ZExt(m_Value(A))) &&
3740 match(Op0, m_And(m_Value(B), m_ConstantInt(Cst1))) &&
3751 if ((match(Op0, m_OneUse(m_LShr(m_Value(A), m_ConstantInt(Cst1)))) &&
3753 (match(Op0, m_OneUse(m_AShr(m_Value(A), m_ConstantInt(Cst1)))) &&
3768 if (match(Op0, m_OneUse(m_Shl(m_Value(A), m_ConstantInt(Cst1)))) &&
3785 if (Op0->hasOneUse() &&
3786 match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A),
3796 APInt::getLowBitsSet(ASize, Op0->getType()->getPrimitiveSizeInBits());
3818 if (auto *EVI = dyn_cast<ExtractValueInst>(Op0))
3827 if (match(Op0, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op1 == X)
3831 if (match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op0 == X)
4088 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
4090 if (Value *V = SimplifyFCmpInst(I.getPredicate(), Op0, Op1,
4095 if (Op0 == Op1) {
4104 I.setOperand(1, Constant::getNullValue(Op0->getType()));
4113 I.setOperand(1, Constant::getNullValue(Op0->getType()));
4127 if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
4128 (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
4133 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
4251 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
4255 if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))