Lines Matching refs:LHS
89 static Value *getNewICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS, in getNewICmpValue() argument
92 if (Value *NewConstant = getICmpValue(Sign, Code, LHS, RHS, NewPred)) in getNewICmpValue()
94 return Builder->CreateICmp(NewPred, LHS, RHS); in getNewICmpValue()
101 Value *LHS, Value *RHS, in getFCmpValue() argument
114 if (!isordered) return ConstantInt::getTrue(LHS->getContext()); in getFCmpValue()
117 return Builder->CreateFCmp(Pred, LHS, RHS); in getFCmpValue()
332 Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS, in FoldLogicalPlusAnd() argument
335 Instruction *LHSI = dyn_cast<Instruction>(LHS); in FoldLogicalPlusAnd()
557 ICmpInst *LHS, ICmpInst *RHS, in foldLogOpOfMaskedICmpsHelper() argument
560 if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType()) return 0; in foldLogOpOfMaskedICmpsHelper()
562 if (LHS->getOperand(0)->getType()->isVectorTy()) return 0; in foldLogOpOfMaskedICmpsHelper()
570 Value *L1 = LHS->getOperand(0); in foldLogOpOfMaskedICmpsHelper()
571 Value *L2 = LHS->getOperand(1); in foldLogOpOfMaskedICmpsHelper()
574 if (decomposeBitTestICmp(LHS, LHSCC, L11, L12, L2)) { in foldLogOpOfMaskedICmpsHelper()
668 static Value* foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd, in foldLogOpOfMaskedICmps() argument
671 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in foldLogOpOfMaskedICmps()
672 unsigned mask = foldLogOpOfMaskedICmpsHelper(A, B, C, D, E, LHS, RHS, in foldLogOpOfMaskedICmps()
740 return LHS; in foldLogOpOfMaskedICmps()
752 return LHS; in foldLogOpOfMaskedICmps()
791 Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) { in FoldAndOfICmps() argument
792 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in FoldAndOfICmps()
796 if (LHS->getOperand(0) == RHS->getOperand(1) && in FoldAndOfICmps()
797 LHS->getOperand(1) == RHS->getOperand(0)) in FoldAndOfICmps()
798 LHS->swapOperands(); in FoldAndOfICmps()
799 if (LHS->getOperand(0) == RHS->getOperand(0) && in FoldAndOfICmps()
800 LHS->getOperand(1) == RHS->getOperand(1)) { in FoldAndOfICmps()
801 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in FoldAndOfICmps()
802 unsigned Code = getICmpCode(LHS) & getICmpCode(RHS); in FoldAndOfICmps()
803 bool isSigned = LHS->isSigned() || RHS->isSigned(); in FoldAndOfICmps()
809 if (Value *V = foldLogOpOfMaskedICmps(LHS, RHS, true, Builder)) in FoldAndOfICmps()
813 Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0); in FoldAndOfICmps()
814 ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1)); in FoldAndOfICmps()
838 LHS->hasOneUse() && RHS->hasOneUse()) { in FoldAndOfICmps()
888 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfICmps()
904 std::swap(LHS, RHS); in FoldAndOfICmps()
925 return LHS; in FoldAndOfICmps()
961 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfICmps()
966 return LHS; in FoldAndOfICmps()
978 return LHS; in FoldAndOfICmps()
1027 Value *InstCombiner::FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS) { in FoldAndOfFCmps() argument
1028 if (LHS->getPredicate() == FCmpInst::FCMP_ORD && in FoldAndOfFCmps()
1030 if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType()) in FoldAndOfFCmps()
1034 if (ConstantFP *LHSC = dyn_cast<ConstantFP>(LHS->getOperand(1))) in FoldAndOfFCmps()
1040 return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0)); in FoldAndOfFCmps()
1045 if (isa<ConstantAggregateZero>(LHS->getOperand(1)) && in FoldAndOfFCmps()
1047 return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0)); in FoldAndOfFCmps()
1051 Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1); in FoldAndOfFCmps()
1053 FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate(); in FoldAndOfFCmps()
1067 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1071 return LHS; in FoldAndOfFCmps()
1079 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1081 std::swap(LHS, RHS); in FoldAndOfFCmps()
1089 return LHS; in FoldAndOfFCmps()
1095 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0); in FoldAndOfFCmps()
1289 if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0)) in visitAnd() local
1290 if (Value *Res = FoldAndOfICmps(LHS, RHS)) in visitAnd()
1294 if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0))) in visitAnd() local
1296 if (Value *Res = FoldAndOfFCmps(LHS, RHS)) in visitAnd()
1319 if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp)) in visitAnd() local
1320 if (Value *Res = FoldAndOfICmps(LHS, RHS)) in visitAnd()
1326 if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp)) in visitAnd() local
1327 if (Value *Res = FoldAndOfFCmps(LHS, RHS)) in visitAnd()
1557 Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS) { in FoldOrOfICmps() argument
1558 ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate(); in FoldOrOfICmps()
1562 ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1)); in FoldOrOfICmps()
1565 if (LHS->getPredicate() == ICmpInst::ICMP_EQ && LHSCst && LHSCst->isZero() && in FoldOrOfICmps()
1568 BinaryOperator *LAnd = dyn_cast<BinaryOperator>(LHS->getOperand(0)); in FoldOrOfICmps()
1595 if (LHS->getOperand(0) == RHS->getOperand(1) && in FoldOrOfICmps()
1596 LHS->getOperand(1) == RHS->getOperand(0)) in FoldOrOfICmps()
1597 LHS->swapOperands(); in FoldOrOfICmps()
1598 if (LHS->getOperand(0) == RHS->getOperand(0) && in FoldOrOfICmps()
1599 LHS->getOperand(1) == RHS->getOperand(1)) { in FoldOrOfICmps()
1600 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in FoldOrOfICmps()
1601 unsigned Code = getICmpCode(LHS) | getICmpCode(RHS); in FoldOrOfICmps()
1602 bool isSigned = LHS->isSigned() || RHS->isSigned(); in FoldOrOfICmps()
1609 if (Value *V = foldLogOpOfMaskedICmps(LHS, RHS, false, Builder)) in FoldOrOfICmps()
1612 Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0); in FoldOrOfICmps()
1613 if (LHS->hasOneUse() || RHS->hasOneUse()) { in FoldOrOfICmps()
1628 if (LHSCC == ICmpInst::ICMP_ULT && Val2 == LHS->getOperand(1)) in FoldOrOfICmps()
1631 A = LHS->getOperand(1); in FoldOrOfICmps()
1684 std::swap(LHS, RHS); in FoldOrOfICmps()
1703 if (LHS->getOperand(0) == RHS->getOperand(0)) { in FoldOrOfICmps()
1711 Value *And = Builder->CreateAnd(LHS->getOperand(0), NegCst); in FoldOrOfICmps()
1740 return LHS; in FoldOrOfICmps()
1755 return LHS; in FoldOrOfICmps()
1775 return LHS; in FoldOrOfICmps()
1791 return LHS; in FoldOrOfICmps()
1806 return LHS; in FoldOrOfICmps()
1823 Value *InstCombiner::FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS) { in FoldOrOfFCmps() argument
1824 if (LHS->getPredicate() == FCmpInst::FCMP_UNO && in FoldOrOfFCmps()
1826 LHS->getOperand(0)->getType() == RHS->getOperand(0)->getType()) { in FoldOrOfFCmps()
1827 if (ConstantFP *LHSC = dyn_cast<ConstantFP>(LHS->getOperand(1))) in FoldOrOfFCmps()
1836 return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0)); in FoldOrOfFCmps()
1841 if (isa<ConstantAggregateZero>(LHS->getOperand(1)) && in FoldOrOfFCmps()
1843 return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0)); in FoldOrOfFCmps()
1848 Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1); in FoldOrOfFCmps()
1850 FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate(); in FoldOrOfFCmps()
1862 return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1); in FoldOrOfFCmps()
1866 return LHS; in FoldOrOfFCmps()
2140 if (ICmpInst *LHS = dyn_cast<ICmpInst>(I.getOperand(0))) in visitOr() local
2141 if (Value *Res = FoldOrOfICmps(LHS, RHS)) in visitOr()
2145 if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0))) in visitOr() local
2147 if (Value *Res = FoldOrOfFCmps(LHS, RHS)) in visitOr()
2171 if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp)) in visitOr() local
2172 if (Value *Res = FoldOrOfICmps(LHS, RHS)) in visitOr()
2178 if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp)) in visitOr() local
2179 if (Value *Res = FoldOrOfFCmps(LHS, RHS)) in visitOr()
2451 if (ICmpInst *LHS = dyn_cast<ICmpInst>(I.getOperand(0))) in visitXor() local
2452 if (PredicatesFoldable(LHS->getPredicate(), RHS->getPredicate())) { in visitXor()
2453 if (LHS->getOperand(0) == RHS->getOperand(1) && in visitXor()
2454 LHS->getOperand(1) == RHS->getOperand(0)) in visitXor()
2455 LHS->swapOperands(); in visitXor()
2456 if (LHS->getOperand(0) == RHS->getOperand(0) && in visitXor()
2457 LHS->getOperand(1) == RHS->getOperand(1)) { in visitXor()
2458 Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1); in visitXor()
2459 unsigned Code = getICmpCode(LHS) ^ getICmpCode(RHS); in visitXor()
2460 bool isSigned = LHS->isSigned() || RHS->isSigned(); in visitXor()