• Home
  • Raw
  • Download

Lines Matching refs:LHS

79 static bool isSameCompare(Value *V, CmpInst::Predicate Pred, Value *LHS,  in isSameCompare()  argument
86 if (CPred == Pred && CLHS == LHS && CRHS == RHS) in isSameCompare()
89 CRHS == LHS; in isSameCompare()
128 static Value *ExpandBinOp(unsigned Opcode, Value *LHS, Value *RHS, in ExpandBinOp() argument
137 if (BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS)) in ExpandBinOp()
149 return LHS; in ExpandBinOp()
163 Value *A = LHS, *B = Op1->getOperand(0), *C = Op1->getOperand(1); in ExpandBinOp()
187 static Value *SimplifyAssociativeBinOp(unsigned Opc, Value *LHS, Value *RHS, in SimplifyAssociativeBinOp() argument
196 BinaryOperator *Op0 = dyn_cast<BinaryOperator>(LHS); in SimplifyAssociativeBinOp()
209 if (V == B) return LHS; in SimplifyAssociativeBinOp()
220 Value *A = LHS; in SimplifyAssociativeBinOp()
251 if (V == A) return LHS; in SimplifyAssociativeBinOp()
262 Value *A = LHS; in SimplifyAssociativeBinOp()
286 static Value *ThreadBinOpOverSelect(unsigned Opcode, Value *LHS, Value *RHS, in ThreadBinOpOverSelect() argument
293 if (isa<SelectInst>(LHS)) { in ThreadBinOpOverSelect()
294 SI = cast<SelectInst>(LHS); in ThreadBinOpOverSelect()
303 if (SI == LHS) { in ThreadBinOpOverSelect()
307 TV = SimplifyBinOp(Opcode, LHS, SI->getTrueValue(), Q, MaxRecurse); in ThreadBinOpOverSelect()
308 FV = SimplifyBinOp(Opcode, LHS, SI->getFalseValue(), Q, MaxRecurse); in ThreadBinOpOverSelect()
339 Value *UnsimplifiedLHS = SI == LHS ? UnsimplifiedBranch : LHS; in ThreadBinOpOverSelect()
340 Value *UnsimplifiedRHS = SI == LHS ? RHS : UnsimplifiedBranch; in ThreadBinOpOverSelect()
358 static Value *ThreadCmpOverSelect(CmpInst::Predicate Pred, Value *LHS, in ThreadCmpOverSelect() argument
366 if (!isa<SelectInst>(LHS)) { in ThreadCmpOverSelect()
367 std::swap(LHS, RHS); in ThreadCmpOverSelect()
370 assert(isa<SelectInst>(LHS) && "Not comparing with a select instruction!"); in ThreadCmpOverSelect()
371 SelectInst *SI = cast<SelectInst>(LHS); in ThreadCmpOverSelect()
440 static Value *ThreadBinOpOverPHI(unsigned Opcode, Value *LHS, Value *RHS, in ThreadBinOpOverPHI() argument
447 if (isa<PHINode>(LHS)) { in ThreadBinOpOverPHI()
448 PI = cast<PHINode>(LHS); in ThreadBinOpOverPHI()
456 if (!ValueDominatesPHI(LHS, PI, Q.DT)) in ThreadBinOpOverPHI()
466 Value *V = PI == LHS ? in ThreadBinOpOverPHI()
468 SimplifyBinOp(Opcode, LHS, Incoming, Q, MaxRecurse); in ThreadBinOpOverPHI()
483 static Value *ThreadCmpOverPHI(CmpInst::Predicate Pred, Value *LHS, Value *RHS, in ThreadCmpOverPHI() argument
490 if (!isa<PHINode>(LHS)) { in ThreadCmpOverPHI()
491 std::swap(LHS, RHS); in ThreadCmpOverPHI()
494 assert(isa<PHINode>(LHS) && "Not comparing with a phi instruction!"); in ThreadCmpOverPHI()
495 PHINode *PI = cast<PHINode>(LHS); in ThreadCmpOverPHI()
639 Value *LHS, Value *RHS) { in computePointerDifference() argument
640 Constant *LHSOffset = stripAndComputeConstantOffsets(DL, LHS); in computePointerDifference()
645 if (LHS != RHS) in computePointerDifference()
1638 Value *LHS, Value *RHS) { in ExtractEquivalentCondition() argument
1646 if (Pred == Cmp->getPredicate() && LHS == CmpLHS && RHS == CmpRHS) in ExtractEquivalentCondition()
1649 LHS == CmpRHS && RHS == CmpLHS) in ExtractEquivalentCondition()
1685 Value *LHS, Value *RHS) { in computePointerICmp() argument
1687 LHS = LHS->stripPointerCasts(); in computePointerICmp()
1691 if (llvm::isKnownNonNull(LHS, TLI) && isa<ConstantPointerNull>(RHS) && in computePointerICmp()
1693 return ConstantInt::get(GetCompareTy(LHS), in computePointerICmp()
1724 Constant *LHSOffset = stripAndComputeConstantOffsets(DL, LHS); in computePointerICmp()
1729 if (LHS == RHS) in computePointerICmp()
1763 if (isa<AllocaInst>(LHS) && in computePointerICmp()
1769 getObjectSize(LHS, LHSSize, DL, TLI) && in computePointerICmp()
1777 return ConstantInt::get(GetCompareTy(LHS), in computePointerICmp()
1784 if (!cast<PointerType>(LHS->getType())->isEmptyTy() && in computePointerICmp()
1788 return ConstantInt::get(GetCompareTy(LHS), in computePointerICmp()
1796 Constant *LHSNoBound = stripAndComputeConstantOffsets(DL, LHS, true); in computePointerICmp()
1798 if (LHS == RHS) in computePointerICmp()
1810 static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyICmpInst() argument
1815 if (Constant *CLHS = dyn_cast<Constant>(LHS)) { in SimplifyICmpInst()
1820 std::swap(LHS, RHS); in SimplifyICmpInst()
1824 Type *ITy = GetCompareTy(LHS); // The return type. in SimplifyICmpInst()
1825 Type *OpTy = LHS->getType(); // The operand type. in SimplifyICmpInst()
1830 if (LHS == RHS || isa<UndefValue>(RHS)) in SimplifyICmpInst()
1840 return LHS; in SimplifyICmpInst()
1845 return LHS; in SimplifyICmpInst()
1850 return LHS; in SimplifyICmpInst()
1855 return LHS; in SimplifyICmpInst()
1860 return LHS; in SimplifyICmpInst()
1865 return LHS; in SimplifyICmpInst()
1881 if (isKnownNonZero(LHS, Q.DL)) in SimplifyICmpInst()
1886 if (isKnownNonZero(LHS, Q.DL)) in SimplifyICmpInst()
1890 ComputeSignBit(LHS, LHSKnownNonNegative, LHSKnownNegative, Q.DL); in SimplifyICmpInst()
1897 ComputeSignBit(LHS, LHSKnownNonNegative, LHSKnownNegative, Q.DL); in SimplifyICmpInst()
1900 if (LHSKnownNonNegative && isKnownNonZero(LHS, Q.DL)) in SimplifyICmpInst()
1904 ComputeSignBit(LHS, LHSKnownNonNegative, LHSKnownNegative, Q.DL); in SimplifyICmpInst()
1911 ComputeSignBit(LHS, LHSKnownNonNegative, LHSKnownNegative, Q.DL); in SimplifyICmpInst()
1914 if (LHSKnownNonNegative && isKnownNonZero(LHS, Q.DL)) in SimplifyICmpInst()
1935 if (match(LHS, m_URem(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1938 } else if (match(LHS, m_SRem(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1942 } else if (match(LHS, m_UDiv(m_ConstantInt(CI2), m_Value()))) { in SimplifyICmpInst()
1945 } else if (match(LHS, m_UDiv(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1950 } else if (match(LHS, m_SDiv(m_ConstantInt(CI2), m_Value()))) { in SimplifyICmpInst()
1960 } else if (match(LHS, m_SDiv(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1969 } else if (match(LHS, m_LShr(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1974 } else if (match(LHS, m_LShr(m_ConstantInt(CI2), m_Value()))) { in SimplifyICmpInst()
1977 if (!CI2->isZero() && cast<BinaryOperator>(LHS)->isExact()) in SimplifyICmpInst()
1981 } else if (match(LHS, m_AShr(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
1989 } else if (match(LHS, m_AShr(m_ConstantInt(CI2), m_Value()))) { in SimplifyICmpInst()
1991 if (!CI2->isZero() && cast<BinaryOperator>(LHS)->isExact()) in SimplifyICmpInst()
2002 } else if (match(LHS, m_Or(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
2005 } else if (match(LHS, m_And(m_Value(), m_ConstantInt(CI2)))) { in SimplifyICmpInst()
2019 if (isa<CastInst>(LHS) && (isa<Constant>(RHS) || isa<CastInst>(RHS))) { in SimplifyICmpInst()
2020 Instruction *LI = cast<CastInst>(LHS); in SimplifyICmpInst()
2044 if (isa<ZExtInst>(LHS)) { in SimplifyICmpInst()
2104 if (isa<SExtInst>(LHS)) { in SimplifyICmpInst()
2184 computeKnownBits(LHS, LHSKnownZero, LHSKnownOne); in SimplifyICmpInst()
2197 BinaryOperator *LBO = dyn_cast<BinaryOperator>(LHS); in SimplifyICmpInst()
2225 if ((C == LHS || D == LHS) && NoRHSWrapProblem) in SimplifyICmpInst()
2227 Constant::getNullValue(LHS->getType()), in SimplifyICmpInst()
2228 C == LHS ? D : C, Q, MaxRecurse-1)) in SimplifyICmpInst()
2260 if (!CmpInst::isUnsigned(Pred) && match(LHS, m_Neg(m_ZExt(m_Value())))) { in SimplifyICmpInst()
2311 if (RBO && match(RBO, m_URem(m_Value(), m_Specific(LHS)))) { in SimplifyICmpInst()
2318 ComputeSignBit(LHS, KnownNonNegative, KnownNegative, Q.DL); in SimplifyICmpInst()
2328 ComputeSignBit(LHS, KnownNonNegative, KnownNegative, Q.DL); in SimplifyICmpInst()
2386 if (match(LHS, m_SMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) { in SimplifyICmpInst()
2392 (A == LHS || B == LHS)) { in SimplifyICmpInst()
2393 if (A != LHS) std::swap(A, B); // A pred smax(A, B). in SimplifyICmpInst()
2397 } else if (match(LHS, m_SMin(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2405 (A == LHS || B == LHS)) { in SimplifyICmpInst()
2406 if (A != LHS) std::swap(A, B); // A pred smin(A, B). in SimplifyICmpInst()
2421 if (Value *V = ExtractEquivalentCondition(LHS, EqP, A, B)) in SimplifyICmpInst()
2435 if (Value *V = ExtractEquivalentCondition(LHS, InvEqP, A, B)) in SimplifyICmpInst()
2456 if (match(LHS, m_UMax(m_Value(A), m_Value(B))) && (A == RHS || B == RHS)) { in SimplifyICmpInst()
2462 (A == LHS || B == LHS)) { in SimplifyICmpInst()
2463 if (A != LHS) std::swap(A, B); // A pred umax(A, B). in SimplifyICmpInst()
2467 } else if (match(LHS, m_UMin(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2475 (A == LHS || B == LHS)) { in SimplifyICmpInst()
2476 if (A != LHS) std::swap(A, B); // A pred umin(A, B). in SimplifyICmpInst()
2491 if (Value *V = ExtractEquivalentCondition(LHS, EqP, A, B)) in SimplifyICmpInst()
2505 if (Value *V = ExtractEquivalentCondition(LHS, InvEqP, A, B)) in SimplifyICmpInst()
2526 if (match(LHS, m_SMax(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2536 } else if (match(LHS, m_SMin(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2546 } else if (match(LHS, m_UMax(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2556 } else if (match(LHS, m_UMin(m_Value(A), m_Value(B))) && in SimplifyICmpInst()
2570 if (LHS->getType()->isPointerTy()) in SimplifyICmpInst()
2571 if (Constant *C = computePointerICmp(Q.DL, Q.TLI, Pred, LHS, RHS)) in SimplifyICmpInst()
2574 if (GetElementPtrInst *GLHS = dyn_cast<GetElementPtrInst>(LHS)) { in SimplifyICmpInst()
2597 if (isa<SelectInst>(LHS) || isa<SelectInst>(RHS)) in SimplifyICmpInst()
2598 if (Value *V = ThreadCmpOverSelect(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
2603 if (isa<PHINode>(LHS) || isa<PHINode>(RHS)) in SimplifyICmpInst()
2604 if (Value *V = ThreadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
2610 Value *llvm::SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyICmpInst() argument
2614 return ::SimplifyICmpInst(Predicate, LHS, RHS, Query (DL, TLI, DT), in SimplifyICmpInst()
2620 static Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyFCmpInst() argument
2625 if (Constant *CLHS = dyn_cast<Constant>(LHS)) { in SimplifyFCmpInst()
2630 std::swap(LHS, RHS); in SimplifyFCmpInst()
2636 return ConstantInt::get(GetCompareTy(LHS), 0); in SimplifyFCmpInst()
2638 return ConstantInt::get(GetCompareTy(LHS), 1); in SimplifyFCmpInst()
2641 return UndefValue::get(GetCompareTy(LHS)); in SimplifyFCmpInst()
2644 if (LHS == RHS) { in SimplifyFCmpInst()
2646 return ConstantInt::get(GetCompareTy(LHS), 1); in SimplifyFCmpInst()
2648 return ConstantInt::get(GetCompareTy(LHS), 0); in SimplifyFCmpInst()
2694 if (isa<SelectInst>(LHS) || isa<SelectInst>(RHS)) in SimplifyFCmpInst()
2695 if (Value *V = ThreadCmpOverSelect(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyFCmpInst()
2700 if (isa<PHINode>(LHS) || isa<PHINode>(RHS)) in SimplifyFCmpInst()
2701 if (Value *V = ThreadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyFCmpInst()
2707 Value *llvm::SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyFCmpInst() argument
2711 return ::SimplifyFCmpInst(Predicate, LHS, RHS, Query (DL, TLI, DT), in SimplifyFCmpInst()
2888 static Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, in SimplifyBinOp() argument
2892 return SimplifyAddInst(LHS, RHS, /*isNSW*/false, /*isNUW*/false, in SimplifyBinOp()
2895 return SimplifyFAddInst(LHS, RHS, FastMathFlags(), Q, MaxRecurse); in SimplifyBinOp()
2898 return SimplifySubInst(LHS, RHS, /*isNSW*/false, /*isNUW*/false, in SimplifyBinOp()
2901 return SimplifyFSubInst(LHS, RHS, FastMathFlags(), Q, MaxRecurse); in SimplifyBinOp()
2903 case Instruction::Mul: return SimplifyMulInst (LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2905 return SimplifyFMulInst (LHS, RHS, FastMathFlags(), Q, MaxRecurse); in SimplifyBinOp()
2906 case Instruction::SDiv: return SimplifySDivInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2907 case Instruction::UDiv: return SimplifyUDivInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2908 case Instruction::FDiv: return SimplifyFDivInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2909 case Instruction::SRem: return SimplifySRemInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2910 case Instruction::URem: return SimplifyURemInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2911 case Instruction::FRem: return SimplifyFRemInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2913 return SimplifyShlInst(LHS, RHS, /*isNSW*/false, /*isNUW*/false, in SimplifyBinOp()
2916 return SimplifyLShrInst(LHS, RHS, /*isExact*/false, Q, MaxRecurse); in SimplifyBinOp()
2918 return SimplifyAShrInst(LHS, RHS, /*isExact*/false, Q, MaxRecurse); in SimplifyBinOp()
2919 case Instruction::And: return SimplifyAndInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2920 case Instruction::Or: return SimplifyOrInst (LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2921 case Instruction::Xor: return SimplifyXorInst(LHS, RHS, Q, MaxRecurse); in SimplifyBinOp()
2923 if (Constant *CLHS = dyn_cast<Constant>(LHS)) in SimplifyBinOp()
2926 return ConstantFoldInstOperands(Opcode, LHS->getType(), COps, Q.DL, in SimplifyBinOp()
2932 if (Value *V = SimplifyAssociativeBinOp(Opcode, LHS, RHS, Q, MaxRecurse)) in SimplifyBinOp()
2937 if (isa<SelectInst>(LHS) || isa<SelectInst>(RHS)) in SimplifyBinOp()
2938 if (Value *V = ThreadBinOpOverSelect(Opcode, LHS, RHS, Q, MaxRecurse)) in SimplifyBinOp()
2943 if (isa<PHINode>(LHS) || isa<PHINode>(RHS)) in SimplifyBinOp()
2944 if (Value *V = ThreadBinOpOverPHI(Opcode, LHS, RHS, Q, MaxRecurse)) in SimplifyBinOp()
2951 Value *llvm::SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, in SimplifyBinOp() argument
2954 return ::SimplifyBinOp(Opcode, LHS, RHS, Query (DL, TLI, DT), RecursionLimit); in SimplifyBinOp()
2959 static Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyCmpInst() argument
2962 return SimplifyICmpInst(Predicate, LHS, RHS, Q, MaxRecurse); in SimplifyCmpInst()
2963 return SimplifyFCmpInst(Predicate, LHS, RHS, Q, MaxRecurse); in SimplifyCmpInst()
2966 Value *llvm::SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS, in SimplifyCmpInst() argument
2969 return ::SimplifyCmpInst(Predicate, LHS, RHS, Query (DL, TLI, DT), in SimplifyCmpInst()