Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:Op1

1811   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
1816 if (getComplexity(Op0) < getComplexity(Op1)) {
1818 std::swap(Op0, Op1);
1822 if (Value *V = SimplifyICmpInst(I.getPredicate(), Op0, Op1, TD))
1827 if (I.getPredicate() == ICmpInst::ICMP_NE && match(Op1, m_Zero()))
1834 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
1838 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
1850 Value *Xor = Builder->CreateXor(Op0, Op1, I.getName()+"tmp");
1854 return BinaryOperator::CreateXor(Op0, Op1);
1857 std::swap(Op0, Op1); // Change icmp ugt -> icmp ult
1861 return BinaryOperator::CreateAnd(Not, Op1);
1864 std::swap(Op0, Op1); // Change icmp sgt -> icmp slt
1867 Value *Not = Builder->CreateNot(Op1, I.getName()+"tmp");
1871 std::swap(Op0, Op1); // Change icmp uge -> icmp ule
1875 return BinaryOperator::CreateOr(Not, Op1);
1878 std::swap(Op0, Op1); // Change icmp sge -> icmp sle
1881 Value *Not = Builder->CreateNot(Op1, I.getName()+"tmp");
1896 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
1993 ConstantInt::get(Op0->getType(), Op0Min), Op1);
1994 if (!isa<Constant>(Op1) && Op1Min == Op1Max)
1996 ConstantInt::get(Op1->getType(), Op1Min));
2082 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2083 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
2101 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2102 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
2119 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2120 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
2133 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
2134 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
2141 assert(!isa<ConstantInt>(Op1) && "ICMP_SGE with ConstantInt not folded!");
2148 assert(!isa<ConstantInt>(Op1) && "ICMP_SLE with ConstantInt not folded!");
2155 assert(!isa<ConstantInt>(Op1) && "ICMP_UGE with ConstantInt not folded!");
2162 assert(!isa<ConstantInt>(Op1) && "ICMP_ULE with ConstantInt not folded!");
2175 return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);
2187 if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
2188 (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
2193 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
2203 if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
2225 Value *Op1 = 0, *Op2 = 0;
2227 Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC);
2237 if ((Op1 && Op2) || (LHSI->hasOneUse() && (Op1 || Op2))) {
2238 if (!Op1)
2239 Op1 = Builder->CreateICmp(I.getPredicate(), LHSI->getOperand(1),
2244 return SelectInst::Create(LHSI->getOperand(0), Op1, Op2);
2273 if (Instruction *NI = FoldGEPICmp(GEP, Op1, I.getPredicate(), I))
2275 if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op1))
2285 (isa<Constant>(Op1) || isa<BitCastInst>(Op1))) {
2292 if (BitCastInst *CI2 = dyn_cast<BitCastInst>(Op1))
2293 Op1 = CI2->getOperand(0);
2295 // If Op1 is a constant, we can fold the cast into the constant.
2296 if (Op0->getType() != Op1->getType()) {
2297 if (Constant *Op1C = dyn_cast<Constant>(Op1)) {
2298 Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
2301 Op1 = Builder->CreateBitCast(Op1, Op0->getType());
2304 return new ICmpInst(I.getPredicate(), Op0, Op1);
2315 if (isa<Constant>(Op1) || isa<CastInst>(Op1))
2322 BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1);
2335 // Analyze the case when either Op0 or Op1 is an add instruction.
2336 // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
2344 if ((A == Op1 || B == Op1) && NoOp0WrapProblem)
2345 return new ICmpInst(Pred, A == Op1 ? B : A,
2346 Constant::getNullValue(Op1->getType()));
2364 // Analyze the case when either Op0 or Op1 is a sub instruction.
2365 // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).
2373 if (A == Op1 && NoOp0WrapProblem)
2374 return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B);
2395 Op1 == BO0->getOperand(1))
2500 if (match(Op1, m_Not(m_Value(B))))
2502 if (ConstantInt *RHSC = dyn_cast<ConstantInt>(Op1))
2510 (Op1 == A || Op1 == B))
2517 match(Op1, m_Add(m_Value(A), m_Value(B))) &&
2519 if (Instruction *R = ProcessUAddIdiom(I, Op1, *this))
2527 if (A == Op1 || B == Op1) { // (A^B) == A -> B == 0
2528 Value *OtherVal = A == Op1 ? B : A;
2533 if (match(Op1, m_Xor(m_Value(C), m_Value(D)))) {
2537 match(D, m_ConstantInt(C2)) && Op1->hasOneUse()) {
2552 if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&
2562 match(Op1, m_OneUse(m_And(m_Value(C), m_Value(D))))) {
2576 Op1 = Builder->CreateXor(X, Y);
2577 Op1 = Builder->CreateAnd(Op1, Z);
2578 I.setOperand(0, Op1);
2579 I.setOperand(1, Constant::getNullValue(Op1->getType()));
2589 match(Op1, m_And(m_Value(B), m_ConstantInt(Cst1)))) ||
2590 (Op1->hasOneUse() &&
2592 match(Op1, m_ZExt(m_Value(A))))) {
2606 match(Op1, m_ConstantInt(Cst1)) &&
2629 if (match(Op0, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op1 == X)
2633 if (match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op0 == X)
2634 return FoldICmpAddOpCst(I, X, Cst, I.getSwappedPredicate(), Op1);
2858 Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
2860 if (Value *V = SimplifyFCmpInst(I.getPredicate(), Op0, Op1, TD))
2864 if (Op0 == Op1) {
2888 if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
2950 Value *Op1 = 0, *Op2 = 0;
2954 Op1 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC);
2962 Op1 = Builder->CreateFCmp(I.getPredicate(), LHSI->getOperand(1),
2967 if (Op1)
2968 return SelectInst::Create(LHSI->getOperand(0), Op1, Op2);
3032 if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
3037 if (FPExtInst *RHSExt = dyn_cast<FPExtInst>(Op1))