Lines Matching refs:Op0

2049 /// \brief Check if the order of \p Op0 and \p Op1 as operand in an ICmpInst
2056 /// \return true if Op0 and Op1 should be swapped.
2057 static bool swapMayExposeCSEOpportunities(const Value * Op0,
2061 if (Op0->getType()->isPointerTy())
2063 // Count every uses of both Op0 and Op1 in a subtract.
2064 // Each time Op0 is the first operand, count -1: swapping is bad, the
2066 // Each time Op0 is the second operand, count +1: swapping is good, the
2068 // At the end, if the benefit is greater than 0, Op0 should come second to
2071 for (Value::const_use_iterator UI = Op0->use_begin(), UIEnd = Op0->use_end(); UI != UIEnd; ++UI) {
2075 // If Op0 is the first argument, this is not beneficial to swap the
2079 if (BinOp->getOperand(Op1Idx) == Op0) {
2092 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
2093 unsigned Op0Cplxity = getComplexity(Op0);
2101 swapMayExposeCSEOpportunities(Op0, Op1))) {
2103 std::swap(Op0, Op1);
2107 if (Value *V = SimplifyICmpInst(I.getPredicate(), Op0, Op1, TD))
2115 if (match(Op0, m_Select(m_Value(Cond), m_Value(SelectTrue),
2128 Type *Ty = Op0->getType();
2135 Value *Xor = Builder->CreateXor(Op0, Op1, I.getName()+"tmp");
2139 return BinaryOperator::CreateXor(Op0, Op1);
2142 std::swap(Op0, Op1); // Change icmp ugt -> icmp ult
2145 Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp");
2149 std::swap(Op0, Op1); // Change icmp sgt -> icmp slt
2153 return BinaryOperator::CreateAnd(Not, Op0);
2156 std::swap(Op0, Op1); // Change icmp uge -> icmp ule
2159 Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp");
2163 std::swap(Op0, Op1); // Change icmp sge -> icmp sle
2167 return BinaryOperator::CreateOr(Not, Op0);
2199 match(Op0, m_Add(m_Add(m_Value(A), m_Value(B)), m_ConstantInt(CI2))))
2206 match(Op0, m_Sub(m_Value(A), m_Value(B)))) {
2219 return new ICmpInst(ICmpInst::ICMP_ULT, Op0,
2223 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
2227 return new ICmpInst(ICmpInst::ICMP_UGT, Op0,
2231 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
2276 if (!isa<Constant>(Op0) && Op0Min == Op0Max)
2278 ConstantInt::get(Op0->getType(), Op0Min), Op1);
2280 return new ICmpInst(I.getPredicate(), Op0,
2299 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
2301 LHS = Op0;
2336 if (!match(Op0, m_And(m_Value(LHS), m_ConstantInt(LHSC))) ||
2338 LHS = Op0;
2367 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2370 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2375 return new ICmpInst(ICmpInst::ICMP_SGT, Op0,
2376 Constant::getAllOnesValue(Op0->getType()));
2386 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2389 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2394 return new ICmpInst(ICmpInst::ICMP_SLT, Op0,
2395 Constant::getNullValue(Op0->getType()));
2404 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2407 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2418 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2421 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
2460 return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);
2472 if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
2473 (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
2482 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
2489 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
2557 if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op0))
2561 if (Instruction *NI = FoldGEPICmp(GEP, Op0,
2568 if (BitCastInst *CI = dyn_cast<BitCastInst>(Op0)) {
2569 if (Op0->getType()->isPointerTy() &&
2573 Op0 = CI->getOperand(0);
2581 if (Op0->getType() != Op1->getType()) {
2583 Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
2586 Op1 = Builder->CreateBitCast(Op1, Op0->getType());
2589 return new ICmpInst(I.getPredicate(), Op0, Op1);
2593 if (isa<CastInst>(Op0)) {
2606 BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);
2620 // Analyze the case when either Op0 or Op1 is an add instruction.
2621 // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
2634 if ((C == Op0 || D == Op0) && NoOp1WrapProblem)
2635 return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()),
2636 C == Op0 ? D : C);
2715 // Analyze the case when either Op0 or Op1 is a sub instruction.
2716 // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).
2728 if (C == Op0 && NoOp1WrapProblem)
2729 return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType()));
2750 Op0 == BO1->getOperand(1))
2851 if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&
2859 if (match(Op0, m_Not(m_Value(A)))) {
2869 match(Op0, m_Add(m_Value(A), m_Value(B))) &&
2871 if (Instruction *R = ProcessUAddIdiom(I, Op0, *this))
2878 (Op0 == A || Op0 == B))
2886 if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) {
2912 (A == Op0 || B == Op0)) {
2914 Value *OtherVal = A == Op0 ? B : A;
2920 if (match(Op0, m_OneUse(m_And(m_Value(A), m_Value(B)))) &&
2946 if ((Op0->hasOneUse() &&
2947 match(Op0, m_ZExt(m_Value(A))) &&
2950 match(Op0, m_And(m_Value(B), m_ConstantInt(Cst1))) &&
2961 if ((match(Op0, m_OneUse(m_LShr(m_Value(A), m_ConstantInt(Cst1)))) &&
2963 (match(Op0, m_OneUse(m_AShr(m_Value(A), m_ConstantInt(Cst1)))) &&
2980 if (Op0->hasOneUse() &&
2981 match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A),
2991 APInt::getLowBitsSet(ASize, Op0->getType()->getPrimitiveSizeInBits());
3006 if (match(Op0, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op1 == X)
3010 if (match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op0 == X)
3230 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
3232 if (Value *V = SimplifyFCmpInst(I.getPredicate(), Op0, Op1, TD))
3236 if (Op0 == Op1) {
3245 I.setOperand(1, Constant::getNullValue(Op0->getType()));
3254 I.setOperand(1, Constant::getNullValue(Op0->getType()));
3261 if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
3402 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
3406 if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))