Lines Matching full:ici
236 CmpInst &ICI, ConstantInt *AndCst) {
308 Constant *CompareRHS = cast<Constant>(ICI.getOperand(1));
321 Constant *C = ConstantFoldCompareInstOperands(ICI.getPredicate(), Elt,
411 return replaceInstUsesWith(ICI, Builder->getFalse());
431 return replaceInstUsesWith(ICI, Builder->getTrue());
1059 Instruction *InstCombiner::FoldAllocaCmp(ICmpInst &ICI, AllocaInst *Alloca,
1061 assert(ICI.isEquality() && "Cannot fold non-equality comparison.");
1132 ICI,
1133 ConstantInt::get(CmpTy, !CmpInst::isTrueWhenEqual(ICI.getPredicate())));
1137 Instruction *InstCombiner::FoldICmpAddOpCst(Instruction &ICI,
1186 Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI,
1188 ConstantInt *CmpRHS = cast<ConstantInt>(ICI.getOperand(1));
1200 if (!ICI.isEquality() && DivIsSigned != ICI.isSigned())
1208 ICI.setOperand(0, DivI->getOperand(0)); // X/1 == X.
1209 return &ICI;
1225 ICmpInst::Predicate Pred = ICI.getPredicate();
1302 return replaceInstUsesWith(ICI, Builder->getFalse());
1309 return replaceInstUsesWith(ICI, InsertRangeTest(X, LoBound, HiBound,
1313 return replaceInstUsesWith(ICI, Builder->getTrue());
1320 return replaceInstUsesWith(ICI, InsertRangeTest(X, LoBound, HiBound,
1325 return replaceInstUsesWith(ICI, Builder->getTrue());
1327 return replaceInstUsesWith(ICI, Builder->getFalse());
1332 return replaceInstUsesWith(ICI, Builder->getFalse());
1334 return replaceInstUsesWith(ICI, Builder->getTrue());
1342 Instruction *InstCombiner::FoldICmpShrCst(ICmpInst &ICI, BinaryOperator *Shr,
1344 const APInt &CmpRHSV = cast<ConstantInt>(ICI.getOperand(1))->getValue();
1354 if (!ICI.isEquality()) {
1357 if (ICI.isSigned() != (Shr->getOpcode() == Instruction::AShr))
1378 ICI.setOperand(0, Tmp);
1383 return &ICI;
1389 Instruction *Res = FoldICmpDivCst(ICI, TheDiv, cast<ConstantInt>(DivCst));
1404 bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE;
1406 return replaceInstUsesWith(ICI, Cst);
1413 return new ICmpInst(ICI.getPredicate(), Shr->getOperand(0), ShiftedCmpRHS);
1422 return new ICmpInst(ICI.getPredicate(), And, ShiftedCmpRHS);
1538 Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
1548 if (ICI.getPredicate() == ICmpInst::ICMP_SLT &&
1553 if (ICI.isEquality() && LHSI->hasOneUse()) {
1559 computeKnownBits(LHSI->getOperand(0), KnownZero, KnownOne, 0, &ICI);
1566 return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0),
1576 if ((ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0) ||
1577 (ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue())) {
1583 ICI.setOperand(0, CompareVal);
1585 return &ICI;
1589 bool isTrueIfPositive = ICI.getPredicate() == ICmpInst::ICMP_SGT;
1604 if (!ICI.isEquality() && XorCst->getValue().isSignBit()) {
1606 ICmpInst::Predicate Pred = ICI.isSigned()
1607 ? ICI.getUnsignedPredicate()
1608 : ICI.getSignedPredicate();
1614 if (!ICI.isEquality() && XorCst->isMaxValue(true)) {
1616 ICmpInst::Predicate Pred = ICI.isSigned()
1617 ? ICI.getUnsignedPredicate()
1618 : ICI.getSignedPredicate();
1619 Pred = ICI.getSwappedPredicate(Pred);
1627 if (ICI
1633 if (ICI.getPredicate() == ICmpInst::ICMP_ULT &&
1651 if (ICI.isEquality() ||
1657 return new ICmpInst(ICI.getPredicate(), NewAnd,
1668 if (ICI.isEquality() && RHSV.getActiveBits() <= Ty->getBitWidth()) {
1673 return new ICmpInst(ICI.getPredicate(), NewAnd,
1705 if (!ICI.isSigned() || (!AndCst->isNegative() && !RHS->isNegative()))
1713 if (!ICI.isSigned())
1739 if (ICI.getPredicate() == ICmpInst::ICMP_EQ)
1740 return replaceInstUsesWith(ICI, Builder->getFalse());
1741 if (ICI.getPredicate() == ICmpInst::ICMP_NE)
1742 return replaceInstUsesWith(ICI, Builder->getTrue());
1744 ICI.setOperand(1, NewCst);
1753 return &ICI;
1762 ICI.isEquality() && !Shift->isArithmeticShift() &&
1777 ICI.setOperand(0, NewAnd);
1778 return &ICI;
1787 if (!ICI.isSigned() && RHSV == 0) {
1815 ICI.setOperand(0, NewAnd);
1816 return &ICI;
1825 if (ICI.getPredicate() == ICmpInst::ICMP_UGT) {
1842 if (Instruction *Res = FoldCmpLoadFromIndexedGlobal(GEP, GV,ICI, C))
1850 if (ICI.isEquality() && RHS == LHSI->getOperand(1) && (-RHSV).isPowerOf2())
1852 ICI.getPredicate() == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_UGT
1858 if (ICI.isEquality() && LHSI->hasOneUse() && match(RHS, m_Zero())) {
1863 Type *NTy = IntegerType::get(ICI.getContext(), ExactLogBase2 + 1);
1865 return new ICmpInst(ICI.getPredicate() == ICmpInst::ICMP_EQ
1878 if (ICI.getPredicate() == ICmpInst::ICMP_SLT &&
1884 if (!ICI.isEquality() || !RHS->isNullValue() || !LHSI->hasOneUse())
1890 Value *ICIP = Builder->CreateICmp(ICI.getPredicate(), P,
1892 Value *ICIQ = Builder->CreateICmp(ICI.getPredicate(), Q,
1895 if (ICI.getPredicate() == ICmpInst::ICMP_EQ)
1910 ICmpInst::Predicate pred = ICI.getPredicate();
1929 ICmpInst::Predicate Pred = ICI.getPredicate();
1930 if (ICI.isUnsigned()) {
1954 } else if (ICI.isSigned()) {
1978 } else if (ICI.isEquality()) {
1993 if (ICI.isEquality()) {
2000 bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE;
2002 return replaceInstUsesWith(ICI, Cst);
2008 return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0),
2014 return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0),
2025 return new ICmpInst(ICI.getPredicate(), And,
2032 ICmpInst::Predicate pred = ICI.getPredicate();
2042 isSignBitCheck(ICI.getPredicate(), RHS, TrueIfSigned)) {
2062 Type *NTy = IntegerType::get(ICI.getContext(), TypeBits - Amt);
2067 return new ICmpInst(ICI.getPredicate(),
2080 if (Instruction *Res = FoldICmpShrCst(ICI, BO, ShAmt))
2085 if (ICI.isEquality() && BO->isExact() && BO->hasOneUse()) {
2087 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), RHS);
2099 if (ICI.getPredicate() == ICmpInst::ICMP_UGT) {
2106 if (ICI.getPredicate() == ICmpInst::ICMP_ULT) {
2121 if (Instruction *R = FoldICmpDivCst(ICI, cast<BinaryOperator>(LHSI),
2134 if (ICI.getPredicate() == ICmpInst::ICMP_ULT && LHSI->hasOneUse() &&
2143 if (ICI.getPredicate() == ICmpInst::ICMP_UGT && LHSI->hasOneUse() &&
2152 if (!ICI.isEquality()) {
2157 ConstantRange CR = ICI.makeConstantRange(ICI.getPredicate(), RHSV)
2160 if (ICI.isSigned()) {
2181 if (ICI.getPredicate() == ICmpInst::ICMP_ULT && LHSI->hasOneUse() &&
2190 if (ICI.getPredicate() == ICmpInst::ICMP_UGT && LHSI->hasOneUse() &&
2200 if (ICI.isEquality()) {
2201 bool isICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE;
2215 return new ICmpInst(ICI.getPredicate(), NewRem,
2224 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0),
2232 return new ICmpInst(ICI.getPredicate(), BOp0, NegVal);
2234 return new ICmpInst(ICI.getPredicate(), NegVal, BOp1);
2238 return new ICmpInst(ICI.getPredicate(), BOp0, Neg);
2247 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0),
2251 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0),
2260 return new ICmpInst(ICI.getPredicate(), BO->getOperand(1),
2264 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0),
2275 return replaceInstUsesWith(ICI, Builder->getInt1(isICMP_NE));
2283 return new ICmpInst(ICI.getPredicate(), And, NotBOC);
2293 return replaceInstUsesWith(ICI, Builder->getInt1(isICMP_NE));
2331 return new ICmpInst(ICI.getPredicate(), BO->getOperand(0),
2343 ICI.setOperand(0, II->getArgOperand(0));
2344 ICI.setOperand(1, Builder->getInt(RHSV.byteSwap()));
2345 return &ICI;
2351 ICI.setOperand(0, II->getArgOperand(0));
2352 ICI.setOperand(1, ConstantInt::get(RHS->getType(), 0));
2353 return &ICI;
2360 ICI.setOperand(0, II->getArgOperand(0));
2361 ICI.setOperand(1, RHS);
2362 return &ICI;