Lines Matching refs:LHS
71 static Value *getNewICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS, in getNewICmpValue() argument
74 if (Value *NewConstant = getICmpValue(Sign, Code, LHS, RHS, NewPred)) in getNewICmpValue()
76 return Builder->CreateICmp(NewPred, LHS, RHS); in getNewICmpValue()
83 Value *LHS, Value *RHS, in getFCmpValue() argument
96 if (!isordered) return ConstantInt::getTrue(LHS->getContext()); in getFCmpValue()
99 return Builder->CreateFCmp(Pred, LHS, RHS); in getFCmpValue()
369 Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS, in FoldLogicalPlusAnd() argument
372 Instruction *LHSI = dyn_cast<Instruction>(LHS); in FoldLogicalPlusAnd()
594 ICmpInst *LHS, ICmpInst *RHS, in foldLogOpOfMaskedICmpsHelper() argument
597 if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType()) return 0; in foldLogOpOfMaskedICmpsHelper()
599 if (LHS->getOperand(0)->getType()->isVectorTy()) return 0; in foldLogOpOfMaskedICmpsHelper()
607 Value *L1 = LHS->getOperand(0); in foldLogOpOfMaskedICmpsHelper()
608 Value *L2 = LHS->getOperand(1); in foldLogOpOfMaskedICmpsHelper()
611 if (decomposeBitTestICmp(LHS, LHSCC, L11, L12, L2)) { in foldLogOpOfMaskedICmpsHelper()
705 static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd, in foldLogOpOfMaskedICmps() argument
708 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in foldLogOpOfMaskedICmps()
709 unsigned mask = foldLogOpOfMaskedICmpsHelper(A, B, C, D, E, LHS, RHS, in foldLogOpOfMaskedICmps()
777 return LHS; in foldLogOpOfMaskedICmps()
789 return LHS; in foldLogOpOfMaskedICmps()
816 return ConstantInt::get(LHS->getType(), !IsAnd); in foldLogOpOfMaskedICmps()
882 Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) { in FoldAndOfICmps() argument
883 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in FoldAndOfICmps()
887 if (LHS->getOperand(0) == RHS->getOperand(1) && in FoldAndOfICmps()
888 LHS->getOperand(1) == RHS->getOperand(0)) in FoldAndOfICmps()
889 LHS->swapOperands(); in FoldAndOfICmps()
890 if (LHS->getOperand(0) == RHS->getOperand(0) && in FoldAndOfICmps()
891 LHS->getOperand(1) == RHS->getOperand(1)) { in FoldAndOfICmps()
892 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in FoldAndOfICmps()
893 unsigned Code = getICmpCode(LHS) & getICmpCode(RHS); in FoldAndOfICmps()
894 bool isSigned = LHS->isSigned() || RHS->isSigned(); in FoldAndOfICmps()
900 if (Value *V = foldLogOpOfMaskedICmps(LHS, RHS, true, Builder)) in FoldAndOfICmps()
904 if (Value *V = simplifyRangeCheck(LHS, RHS, /*Inverted=*/false)) in FoldAndOfICmps()
908 if (Value *V = simplifyRangeCheck(RHS, LHS, /*Inverted=*/false)) in FoldAndOfICmps()
912 Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0); in FoldAndOfICmps()
913 ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1)); in FoldAndOfICmps()
937 LHS->hasOneUse() && RHS->hasOneUse()) { in FoldAndOfICmps()
987 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfICmps()
1003 std::swap(LHS, RHS); in FoldAndOfICmps()
1024 return LHS; in FoldAndOfICmps()
1062 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfICmps()
1067 return LHS; in FoldAndOfICmps()
1079 return LHS; in FoldAndOfICmps()
1128 Value *InstCombiner::FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS) { in FoldAndOfFCmps() argument
1129 if (LHS->getPredicate() == FCmpInst::FCMP_ORD && in FoldAndOfFCmps()
1131 if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType()) in FoldAndOfFCmps()
1135 if (ConstantFP *LHSC = dyn_cast<ConstantFP>(LHS->getOperand(1))) in FoldAndOfFCmps()
1141 return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0)); in FoldAndOfFCmps()
1146 if (isa<ConstantAggregateZero>(LHS->getOperand(1)) && in FoldAndOfFCmps()
1148 return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0)); in FoldAndOfFCmps()
1152 Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1); in FoldAndOfFCmps()
1154 FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate(); in FoldAndOfFCmps()
1168 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1172 return LHS; in FoldAndOfFCmps()
1180 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1182 std::swap(LHS, RHS); in FoldAndOfFCmps()
1190 return LHS; in FoldAndOfFCmps()
1196 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1414 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0); in visitAnd() local
1416 if (LHS && RHS) in visitAnd()
1417 if (Value *Res = FoldAndOfICmps(LHS, RHS)) in visitAnd()
1423 if (LHS && match(Op1, m_OneUse(m_And(m_Value(X), m_Value(Y))))) { in visitAnd()
1425 if (Value *Res = FoldAndOfICmps(LHS, Cmp)) in visitAnd()
1428 if (Value *Res = FoldAndOfICmps(LHS, Cmp)) in visitAnd()
1442 if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0))) in visitAnd() local
1444 if (Value *Res = FoldAndOfFCmps(LHS, RHS)) in visitAnd()
1467 if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp)) in visitAnd() local
1468 if (Value *Res = FoldAndOfICmps(LHS, RHS)) in visitAnd()
1474 if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp)) in visitAnd() local
1475 if (Value *Res = FoldAndOfFCmps(LHS, RHS)) in visitAnd()
1691 Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS, in FoldOrOfICmps() argument
1693 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in FoldOrOfICmps()
1697 ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1)); in FoldOrOfICmps()
1700 if (LHS->getPredicate() == ICmpInst::ICMP_EQ && LHSCst && LHSCst->isZero() && in FoldOrOfICmps()
1703 BinaryOperator *LAnd = dyn_cast<BinaryOperator>(LHS->getOperand(0)); in FoldOrOfICmps()
1744 LHSCC == RHSCC && LHSCst && RHSCst && LHS->hasOneUse() && in FoldOrOfICmps()
1748 Value *LAdd = LHS->getOperand(0); in FoldOrOfICmps()
1781 return (Builder->CreateICmp(LHS->getPredicate(), NewAdd, LHSCst)); in FoldOrOfICmps()
1789 if (LHS->getOperand(0) == RHS->getOperand(1) && in FoldOrOfICmps()
1790 LHS->getOperand(1) == RHS->getOperand(0)) in FoldOrOfICmps()
1791 LHS->swapOperands(); in FoldOrOfICmps()
1792 if (LHS->getOperand(0) == RHS->getOperand(0) && in FoldOrOfICmps()
1793 LHS->getOperand(1) == RHS->getOperand(1)) { in FoldOrOfICmps()
1794 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in FoldOrOfICmps()
1795 unsigned Code = getICmpCode(LHS) | getICmpCode(RHS); in FoldOrOfICmps()
1796 bool isSigned = LHS->isSigned() || RHS->isSigned(); in FoldOrOfICmps()
1803 if (Value *V = foldLogOpOfMaskedICmps(LHS, RHS, false, Builder)) in FoldOrOfICmps()
1806 Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0); in FoldOrOfICmps()
1807 if (LHS->hasOneUse() || RHS->hasOneUse()) { in FoldOrOfICmps()
1822 if (LHSCC == ICmpInst::ICMP_ULT && Val2 == LHS->getOperand(1)) in FoldOrOfICmps()
1825 A = LHS->getOperand(1); in FoldOrOfICmps()
1834 if (Value *V = simplifyRangeCheck(LHS, RHS, /*Inverted=*/true)) in FoldOrOfICmps()
1838 if (Value *V = simplifyRangeCheck(RHS, LHS, /*Inverted=*/true)) in FoldOrOfICmps()
1886 std::swap(LHS, RHS); in FoldOrOfICmps()
1905 if (LHS->getOperand(0) == RHS->getOperand(0)) { in FoldOrOfICmps()
1913 Value *And = Builder->CreateAnd(LHS->getOperand(0), NegCst); in FoldOrOfICmps()
1942 return LHS; in FoldOrOfICmps()
1957 return LHS; in FoldOrOfICmps()
1977 return LHS; in FoldOrOfICmps()
1993 return LHS; in FoldOrOfICmps()
2008 return LHS; in FoldOrOfICmps()
2025 Value *InstCombiner::FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS) { in FoldOrOfFCmps() argument
2026 if (LHS->getPredicate() == FCmpInst::FCMP_UNO && in FoldOrOfFCmps()
2028 LHS->getOperand(0)->getType() == RHS->getOperand(0)->getType()) { in FoldOrOfFCmps()
2029 if (ConstantFP *LHSC = dyn_cast<ConstantFP>(LHS->getOperand(1))) in FoldOrOfFCmps()
2038 return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0)); in FoldOrOfFCmps()
2043 if (isa<ConstantAggregateZero>(LHS->getOperand(1)) && in FoldOrOfFCmps()
2045 return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0)); in FoldOrOfFCmps()
2050 Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1); in FoldOrOfFCmps()
2052 FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate(); in FoldOrOfFCmps()
2064 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1); in FoldOrOfFCmps()
2068 return LHS; in FoldOrOfFCmps()
2426 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0); in visitOr() local
2428 if (LHS && RHS) in visitOr()
2429 if (Value *Res = FoldOrOfICmps(LHS, RHS, &I)) in visitOr()
2435 if (LHS && match(Op1, m_OneUse(m_Or(m_Value(X), m_Value(Y))))) { in visitOr()
2437 if (Value *Res = FoldOrOfICmps(LHS, Cmp, &I)) in visitOr()
2440 if (Value *Res = FoldOrOfICmps(LHS, Cmp, &I)) in visitOr()
2454 if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0))) in visitOr() local
2456 if (Value *Res = FoldOrOfFCmps(LHS, RHS)) in visitOr()
2480 if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp)) in visitOr() local
2481 if (Value *Res = FoldOrOfICmps(LHS, RHS, &I)) in visitOr()
2487 if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp)) in visitOr() local
2488 if (Value *Res = FoldOrOfFCmps(LHS, RHS)) in visitOr()
2809 if (ICmpInst *LHS = dyn_cast<ICmpInst>(I.getOperand(0))) in visitXor() local
2810 if (PredicatesFoldable(LHS->getPredicate(), RHS->getPredicate())) { in visitXor()
2811 if (LHS->getOperand(0) == RHS->getOperand(1) && in visitXor()
2812 LHS->getOperand(1) == RHS->getOperand(0)) in visitXor()
2813 LHS->swapOperands(); in visitXor()
2814 if (LHS->getOperand(0) == RHS->getOperand(0) && in visitXor()
2815 LHS->getOperand(1) == RHS->getOperand(1)) { in visitXor()
2816 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in visitXor()
2817 unsigned Code = getICmpCode(LHS) ^ getICmpCode(RHS); in visitXor()
2818 bool isSigned = LHS->isSigned() || RHS->isSigned(); in visitXor()