Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:Op0

2286 /// \brief Check if the order of \p Op0 and \p Op1 as operand in an ICmpInst
2293 /// \return true if Op0 and Op1 should be swapped.
2294 static bool swapMayExposeCSEOpportunities(const Value * Op0,
2298 if (Op0->getType()->isPointerTy())
2300 // Count every uses of both Op0 and Op1 in a subtract.
2301 // Each time Op0 is the first operand, count -1: swapping is bad, the
2303 // Each time Op0 is the second operand, count +1: swapping is good, the
2305 // At the end, if the benefit is greater than 0, Op0 should come second to
2308 for (const User *U : Op0->users()) {
2312 // If Op0 is the first argument, this is not beneficial to swap the
2316 if (BinOp->getOperand(Op1Idx) == Op0) {
2329 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
2330 unsigned Op0Cplxity = getComplexity(Op0);
2338 swapMayExposeCSEOpportunities(Op0, Op1))) {
2340 std::swap(Op0, Op1);
2344 if (Value *V = SimplifyICmpInst(I.getPredicate(), Op0, Op1, DL))
2352 if (match(Op0, m_Select(m_Value(Cond), m_Value(SelectTrue),
2365 Type *Ty = Op0->getType();
2372 Value *Xor = Builder->CreateXor(Op0, Op1, I.getName()+"tmp");
2376 return BinaryOperator::CreateXor(Op0, Op1);
2379 std::swap(Op0, Op1); // Change icmp ugt -> icmp ult
2382 Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp");
2386 std::swap(Op0, Op1); // Change icmp sgt -> icmp slt
2390 return BinaryOperator::CreateAnd(Not, Op0);
2393 std::swap(Op0, Op1); // Change icmp uge -> icmp ule
2396 Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp");
2400 std::swap(Op0, Op1); // Change icmp sge -> icmp sle
2404 return BinaryOperator::CreateOr(Not, Op0);
2436 match(Op0, m_Add(m_Add(m_Value(A), m_Value(B)), m_ConstantInt(CI2))))
2443 match(Op0, m_Sub(m_Value(A), m_Value(B)))) {
2456 return new ICmpInst(ICmpInst::ICMP_ULT, Op0,
2460 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
2464 return new ICmpInst(ICmpInst::ICMP_UGT, Op0,
2468 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
2513 if (!isa<Constant>(Op0) && Op0Min == Op0Max)
2515 ConstantInt::get(Op0->getType(), Op0Min), Op1);
2517 return new ICmpInst(I.getPredicate(), Op0,
2536 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
2538 LHS = Op0;
2581 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
2583 LHS = Op0;
2620 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2623 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2628 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
2629 Constant::getAllOnesValue(Op0->getType()));
2639 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2642 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2647 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
2648 Constant::getNullValue(Op0->getType()));
2657 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2660 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2671 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2674 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2713 return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);
2725 if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
2726 (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
2735 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
2742 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
2810 if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op0))
2814 if (Instruction *NI = FoldGEPICmp(GEP, Op0,
2821 if (BitCastInst *CI = dyn_cast<BitCastInst>(Op0)) {
2822 if (Op0->getType()->isPointerTy() &&
2826 Op0 = CI->getOperand(0);
2834 if (Op0->getType() != Op1->getType()) {
2836 Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
2839 Op1 = Builder->CreateBitCast(Op1, Op0->getType());
2842 return new ICmpInst(I.getPredicate(), Op0, Op1);
2846 if (isa<CastInst>(Op0)) {
2859 BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);
2873 // Analyze the case when either Op0 or Op1 is an add instruction.
2874 // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
2887 if ((C == Op0 || D == Op0) && NoOp1WrapProblem)
2888 return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()),
2889 C == Op0 ? D : C);
2968 // Analyze the case when either Op0 or Op1 is a sub instruction.
2969 // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).
2981 if (C == Op0 && NoOp1WrapProblem)
2982 return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType()));
3013 Op0 == BO1->getOperand(1))
3114 if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&
3122 if (match(Op0, m_Not(m_Value(A)))) {
3132 match(Op0, m_Add(m_Value(A), m_Value(B))) &&
3134 if (Instruction *R = ProcessUAddIdiom(I, Op0, *this))
3141 (Op0 == A || Op0 == B))
3146 if (match(Op0, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))) {
3147 if (Instruction *R = ProcessUMulZExtIdiom(I, Op0, Op1, *this))
3151 if (Instruction *R = ProcessUMulZExtIdiom(I, Op1, Op0, *this))
3159 if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) {
3185 (A == Op0 || B == Op0)) {
3187 Value *OtherVal = A == Op0 ? B : A;
3193 if (match(Op0, m_OneUse(m_And(m_Value(A), m_Value(B)))) &&
3219 if ((Op0->hasOneUse() &&
3220 match(Op0, m_ZExt(m_Value(A))) &&
3223 match(Op0, m_And(m_Value(B), m_ConstantInt(Cst1))) &&
3234 if ((match(Op0, m_OneUse(m_LShr(m_Value(A), m_ConstantInt(Cst1)))) &&
3236 (match(Op0, m_OneUse(m_AShr(m_Value(A), m_ConstantInt(Cst1)))) &&
3253 if (Op0->hasOneUse() &&
3254 match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A),
3264 APInt::getLowBitsSet(ASize, Op0->getType()->getPrimitiveSizeInBits());
3279 if (match(Op0, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op1 == X)
3283 if (match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op0 == X)
3503 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
3505 Op0, Op1, DL))
3509 if (Op0 == Op1) {
3518 I.setOperand(1, Constant::getNullValue(Op0->getType()));
3527 I.setOperand(1, Constant::getNullValue(Op0->getType()));
3534 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
3650 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
3654 if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))