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