Lines Matching defs:Q
152 const SimplifyQuery &Q);
155 const SimplifyQuery &Q) {
162 ::computeKnownBits(V, DemandedElts, Known, Depth, Q);
270 const SimplifyQuery &Q);
282 const SimplifyQuery &Q, unsigned Depth);
308 const SimplifyQuery &Q);
332 unsigned Depth, const SimplifyQuery &Q);
335 const SimplifyQuery &Q) {
339 return ComputeNumSignBits(V, DemandedElts, Depth, Q);
362 unsigned Depth, const SimplifyQuery &Q) {
363 computeKnownBits(Op1, DemandedElts, KnownOut, Depth + 1, Q);
370 computeKnownBits(Op0, DemandedElts, Known2, Depth + 1, Q);
377 const SimplifyQuery &Q) {
378 computeKnownBits(Op1, DemandedElts, Known, Depth + 1, Q);
379 computeKnownBits(Op0, DemandedElts, Known2, Depth + 1, Q);
409 isGuaranteedNotToBeUndef(Op0, Q.AC, Q.CxtI, Q.DT, Depth + 1);
578 static bool isKnownNonZeroFromAssume(const Value *V, const SimplifyQuery &Q) {
581 if (!Q.AC || !Q.CxtI)
584 for (AssumptionCache::ResultElem &Elem : Q.AC->assumptionsFor(V)) {
589 assert(I->getFunction() == Q.CxtI->getFunction() &&
600 !NullPointerIsDefined(Q.CxtI->getFunction(),
602 isValidAssumeForContext(I, Q.CxtI, Q.DT))
618 if (cmpExcludesZero(Pred, RHS) && isValidAssumeForContext(I, Q.CxtI, Q.DT))
627 const SimplifyQuery &Q) {
652 m_CombineOr(m_Specific(V), m_PtrToIntSameSize(Q.DL, m_Specific(V)));
779 unsigned Depth, const SimplifyQuery &Q) {
781 if (Q.CC && Q.CC->AffectedValues.contains(V))
782 computeKnownBitsFromCond(V, Q.CC->Cond, Known, Depth, Q, Q.CC->Invert);
784 if (!Q.CxtI)
787 if (Q.DC && Q.DT) {
789 for (BranchInst *BI : Q.DC->conditionsFor(V)) {
791 if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
792 computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q,
796 if (Q.DT->dominates(Edge1, Q.CxtI->getParent()))
797 computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q,
805 if (!Q.AC)
813 for (AssumptionCache::ResultElem &Elem : Q.AC->assumptionsFor(V)) {
818 assert(I->getParent()->getParent() == Q.CxtI->getParent()->getParent() &&
828 isValidAssumeForContext(I, Q.CxtI, Q.DT))
840 if (Arg == V && isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
847 isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
862 if (!isValidAssumeForContext(I, Q.CxtI, Q.DT))
865 computeKnownBitsFromICmpCond(V, Cmp, Known, Q, /*Invert=*/false);
884 KnownBits &Known2, unsigned Depth, const SimplifyQuery &Q,
886 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
887 computeKnownBits(I->getOperand(1), DemandedElts, Known, Depth + 1, Q);
893 isKnownNonZero(I->getOperand(1), DemandedElts, Q, Depth + 1));
900 unsigned Depth, const SimplifyQuery &Q) {
957 computeKnownBits(Y, DemandedElts, KnownY, Depth + 1, Q);
970 const SimplifyQuery &Q,
974 getHorizDemandedEltsForFirstOperand(Q.DL.getTypeSizeInBits(I->getType()),
979 [Depth, &Q, KnownBitsFunc](const Value *Op, APInt &DemandedEltsOp) {
981 computeKnownBits(Op, DemandedEltsOp, Depth + 1, Q),
982 computeKnownBits(Op, DemandedEltsOp << 1, Depth + 1, Q));
1029 const SimplifyQuery &Q) {
1036 computeKnownBitsFromCond(Arm, Cond, CondRes, Depth + 1, Q, Invert);
1053 if (!isGuaranteedNotToBeUndef(Arm, Q.AC, Q.CxtI, Q.DT, Depth + 1))
1064 const SimplifyQuery &Q) {
1072 Q.IIQ.getMetadata(cast<LoadInst>(I), LLVMContext::MD_range))
1076 computeKnownBits(I->getOperand(1), DemandedElts, Known, Depth + 1, Q);
1077 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1079 Known = getKnownBitsFromAndXorOr(I, DemandedElts, Known2, Known, Depth, Q);
1082 computeKnownBits(I->getOperand(1), DemandedElts, Known, Depth + 1, Q);
1083 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1085 Known = getKnownBitsFromAndXorOr(I, DemandedElts, Known2, Known, Depth, Q);
1088 computeKnownBits(I->getOperand(1), DemandedElts, Known, Depth + 1, Q);
1089 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1091 Known = getKnownBitsFromAndXorOr(I, DemandedElts, Known2, Known, Depth, Q);
1094 bool NSW = Q.IIQ.hasNoSignedWrap(cast<OverflowingBinaryOperator>(I));
1096 Known, Known2, Depth, Q);
1100 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1101 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1103 KnownBits::udiv(Known, Known2, Q.IIQ.isExact(cast<BinaryOperator>(I)));
1107 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1108 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1110 KnownBits::sdiv(Known, Known2, Q.IIQ.isExact(cast<BinaryOperator>(I)));
1116 computeKnownBits(Arm, DemandedElts, Res, Depth + 1, Q);
1117 adjustKnownBitsForSelectArm(Res, I->getOperand(0), Arm, Invert, Depth, Q);
1146 Q.DL.getPointerTypeSizeInBits(ScalarTy) :
1147 Q.DL.getTypeSizeInBits(ScalarTy);
1151 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1164 computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
1174 computeKnownFPClass(V, DemandedElts, fcAllFlags, Depth + 1, Q);
1243 Depth + 1, Q);
1244 unsigned ShiftElt = Q.DL.isLittleEndian() ? i : SubScale - 1 - i;
1255 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1262 bool NUW = Q.IIQ.hasNoUnsignedWrap(cast<OverflowingBinaryOperator>(I));
1263 bool NSW = Q.IIQ.hasNoSignedWrap(cast<OverflowingBinaryOperator>(I));
1268 computeKnownBitsFromShiftOperator(I, DemandedElts, Known, Known2, Depth, Q,
1277 bool Exact = Q.IIQ.isExact(cast<BinaryOperator>(I));
1282 computeKnownBitsFromShiftOperator(I, DemandedElts, Known, Known2, Depth, Q,
1291 bool Exact = Q.IIQ.isExact(cast<BinaryOperator>(I));
1296 computeKnownBitsFromShiftOperator(I, DemandedElts, Known, Known2, Depth, Q,
1301 bool NSW = Q.IIQ.hasNoSignedWrap(cast<OverflowingBinaryOperator>(I));
1302 bool NUW = Q.IIQ.hasNoUnsignedWrap(cast<OverflowingBinaryOperator>(I));
1304 DemandedElts, Known, Known2, Depth, Q);
1308 bool NSW = Q.IIQ.hasNoSignedWrap(cast<OverflowingBinaryOperator>(I));
1309 bool NUW = Q.IIQ.hasNoUnsignedWrap(cast<OverflowingBinaryOperator>(I));
1311 DemandedElts, Known, Known2, Depth, Q);
1315 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1316 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1321 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1322 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1331 computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
1359 const StructLayout *SL = Q.DL.getStructLayout(STy);
1374 computeKnownBits(Index, IndexBits, Depth + 1, Q);
1375 TypeSize IndexTypeSize = GTI.getSequentialElementStride(Q.DL);
1438 SimplifyQuery RecQ = Q.getWithoutCondContext();
1471 SimplifyQuery RecQ = Q.getWithoutCondContext();
1491 if (OverflowOp && Q.IIQ.hasNoSignedWrap(OverflowOp)) {
1549 SimplifyQuery RecQ = Q.getWithoutCondContext();
1608 Q.IIQ.getMetadata(cast<Instruction>(I), LLVMContext::MD_range))
1618 computeKnownBits(RV, Known2, Depth + 1, Q);
1633 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1639 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1644 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1649 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1660 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1671 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1693 computeKnownBits(I->getOperand(0), DemandedElts, Known2, Depth + 1, Q);
1694 computeKnownBits(I->getOperand(1), DemandedElts, Known3, Depth + 1, Q);
1703 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1704 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1708 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1709 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1713 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1714 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1718 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1719 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1725 Depth + 1, Q);
1735 computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
1738 computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
1753 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1754 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1758 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1759 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1763 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1764 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1768 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1769 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1773 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1777 computeKnownBits(Mask, DemandedElts, Known2, Depth + 1, Q);
1785 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1786 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1792 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth + 1, Q);
1793 computeKnownBits(I->getOperand(1), DemandedElts, Known2, Depth + 1, Q);
1804 I, DemandedElts, Depth, Q,
1815 Q, KnownBits::sadd_sat);
1823 I, DemandedElts, Depth, Q,
1834 Q, KnownBits::ssub_sat);
1888 computeKnownBits(LHS, DemandedLHS, Known, Depth + 1, Q);
1895 computeKnownBits(RHS, DemandedRHS, Known2, Depth + 1, Q);
1920 computeKnownBits(Elt, Known, Depth + 1, Q);
1927 computeKnownBits(Vec, DemandedVecElts, Known2, Depth + 1, Q);
1947 computeKnownBits(Vec, DemandedVecElts, Known, Depth + 1, Q);
1961 /* NUW=*/false, DemandedElts, Known, Known2, Depth, Q);
1967 /* NUW=*/false, DemandedElts, Known, Known2, Depth, Q);
1972 DemandedElts, Known, Known2, Depth, Q);
1979 if (isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
1981 computeKnownBits(I->getOperand(0), Known, Depth + 1, Q);
1989 unsigned Depth, const SimplifyQuery &Q) {
1990 KnownBits Known(getBitWidth(V->getType(), Q.DL));
1991 ::computeKnownBits(V, DemandedElts, Known, Depth, Q);
1998 const SimplifyQuery &Q) {
1999 KnownBits Known(getBitWidth(V->getType(), Q.DL));
2000 computeKnownBits(V, Known, Depth, Q);
2021 const SimplifyQuery &Q) {
2049 assert(BitWidth == Q.DL.getPointerTypeSizeInBits(ScalarTy) &&
2052 assert(BitWidth == Q.DL.getTypeSizeInBits(ScalarTy) &&
2135 computeKnownBits(GA->getAliasee(), Known, Depth + 1, Q);
2140 computeKnownBitsFromOperator(I, DemandedElts, Known, Depth, Q);
2148 Align Alignment = V->getPointerAlignment(Q.DL);
2156 computeKnownBitsFromContext(V, Known, Depth, Q);
2162 unsigned Depth, SimplifyQuery &Q) {
2173 Q.CxtI = PN->getIncomingBlock(U)->getTerminator();
2174 if (!isKnownToBeAPowerOfTwo(Start, OrZero, Depth, Q))
2184 Q.CxtI = BO->getParent()->getTerminator();
2188 return (OrZero || Q.IIQ.hasNoUnsignedWrap(BO) ||
2189 Q.IIQ.hasNoSignedWrap(BO)) &&
2190 isKnownToBeAPowerOfTwo(Step, OrZero, Depth, Q);
2201 return (OrZero || Q.IIQ.isExact(BO)) &&
2202 isKnownToBeAPowerOfTwo(Step, false, Depth, Q);
2204 return OrZero || Q.IIQ.hasNoUnsignedWrap(BO) || Q.IIQ.hasNoSignedWrap(BO);
2210 return OrZero || Q.IIQ.isExact(BO);
2221 const SimplifyQuery &Q) {
2235 if (Q.CxtI && match(V, m_VScale())) {
2236 const Function *F = Q.CxtI->getFunction();
2257 return isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
2259 return OrZero && isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
2261 if (OrZero || Q.IIQ.hasNoUnsignedWrap(I) || Q.IIQ.hasNoSignedWrap(I))
2262 return isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
2265 if (OrZero || Q.IIQ.isExact(cast<BinaryOperator>(I)))
2266 return isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
2269 if (Q.IIQ.isExact(cast<BinaryOperator>(I)))
2270 return isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q);
2273 return isKnownToBeAPowerOfTwo(I->getOperand(1), OrZero, Depth, Q) &&
2274 isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q) &&
2275 (OrZero || isKnownNonZero(I, Q, Depth));
2279 (isKnownToBeAPowerOfTwo(I->getOperand(1), /*OrZero*/ true, Depth, Q) ||
2280 isKnownToBeAPowerOfTwo(I->getOperand(0), /*OrZero*/ true, Depth, Q)))
2285 return OrZero || isKnownNonZero(I->getOperand(0), Q, Depth);
2291 if (OrZero || Q.IIQ.hasNoUnsignedWrap(VOBO) ||
2292 Q.IIQ.hasNoSignedWrap(VOBO)) {
2295 isKnownToBeAPowerOfTwo(I->getOperand(1), OrZero, Depth, Q))
2299 isKnownToBeAPowerOfTwo(I->getOperand(0), OrZero, Depth, Q))
2304 computeKnownBits(I->getOperand(0), LHSBits, Depth, Q);
2307 computeKnownBits(I->getOperand(1), RHSBits, Depth, Q);
2319 if (OrZero || Q.IIQ.hasNoUnsignedWrap(VOBO))
2325 return isKnownToBeAPowerOfTwo(I->getOperand(1), OrZero, Depth, Q) &&
2326 isKnownToBeAPowerOfTwo(I->getOperand(2), OrZero, Depth, Q);
2332 SimplifyQuery RecQ = Q.getWithoutCondContext();
2360 return isKnownToBeAPowerOfTwo(II->getArgOperand(1), OrZero, Depth, Q) &&
2361 isKnownToBeAPowerOfTwo(II->getArgOperand(0), OrZero, Depth, Q);
2366 return isKnownToBeAPowerOfTwo(II->getArgOperand(0), OrZero, Depth, Q);
2371 return isKnownToBeAPowerOfTwo(II->getArgOperand(0), OrZero, Depth, Q);
2391 const SimplifyQuery &Q) {
2408 if (isKnownNonZero(GEP->getPointerOperand(), Q, Depth))
2420 const StructLayout *SL = Q.DL.getStructLayout(STy);
2428 if (GTI.getSequentialElementStride(Q.DL).isZero())
2447 if (isKnownNonZero(GTI.getOperand(), Q, Depth))
2604 const SimplifyQuery &Q, unsigned BitWidth, Value *X,
2611 return isKnownNonZero(Y, DemandedElts, Q, Depth) ||
2612 isKnownNonZero(X, DemandedElts, Q, Depth);
2614 KnownBits XKnown = computeKnownBits(X, DemandedElts, Depth, Q);
2615 KnownBits YKnown = computeKnownBits(Y, DemandedElts, Depth, Q);
2620 if (isKnownNonZero(Y, DemandedElts, Q, Depth) ||
2621 isKnownNonZero(X, DemandedElts, Q, Depth))
2640 isKnownToBeAPowerOfTwo(Y, /*OrZero*/ false, Depth, Q))
2643 isKnownToBeAPowerOfTwo(X, /*OrZero*/ false, Depth, Q))
2651 const SimplifyQuery &Q, unsigned BitWidth, Value *X,
2660 if (C->isNullValue() && isKnownNonZero(Y, DemandedElts, Q, Depth))
2663 return ::isKnownNonEqual(X, Y, DemandedElts, Depth, Q);
2667 const SimplifyQuery &Q, unsigned BitWidth, Value *X,
2672 return isKnownNonZero(X, DemandedElts, Q, Depth) &&
2673 isKnownNonZero(Y, DemandedElts, Q, Depth);
2677 KnownBits XKnown = computeKnownBits(X, DemandedElts, Depth, Q);
2679 return isKnownNonZero(Y, DemandedElts, Q, Depth);
2681 KnownBits YKnown = computeKnownBits(Y, DemandedElts, Depth, Q);
2683 return XKnown.isNonZero() || isKnownNonZero(X, DemandedElts, Q, Depth);
2695 unsigned Depth, const SimplifyQuery &Q,
2726 computeKnownBits(I->getOperand(1), DemandedElts, Depth, Q);
2739 isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth))
2747 unsigned Depth, const SimplifyQuery &Q) {
2748 unsigned BitWidth = getBitWidth(I->getType()->getScalarType(), Q.DL);
2755 return isGEPKnownNonNull(cast<GEPOperator>(I), Depth, Q);
2787 (BitWidth % getBitWidth(FromTy->getScalarType(), Q.DL)) == 0)
2788 return isKnownNonZero(I->getOperand(0), Q, Depth);
2795 Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedValue() <=
2796 Q.DL.getTypeSizeInBits(I->getType()).getFixedValue())
2797 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2803 Q.DL.getTypeSizeInBits(I->getOperand(0)->getType()).getFixedValue() <=
2804 Q.DL.getTypeSizeInBits(I->getType()).getFixedValue())
2805 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2811 return isKnownNonZero(TI->getOperand(0), DemandedElts, Q, Depth);
2815 return isNonZeroSub(DemandedElts, Depth, Q, BitWidth, I->getOperand(0),
2827 return isKnownNonZero(I->getOperand(1), DemandedElts, Q, Depth) ||
2828 isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2832 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2837 if (Q.IIQ.hasNoUnsignedWrap(BO) || Q.IIQ.hasNoSignedWrap(BO))
2838 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2843 computeKnownBits(I->getOperand(0), DemandedElts, Known, Depth, Q);
2847 return isNonZeroShift(I, DemandedElts, Depth, Q, Known);
2854 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2859 computeKnownBits(I->getOperand(0), DemandedElts, Depth, Q);
2863 return isNonZeroShift(I, DemandedElts, Depth, Q, Known);
2870 return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
2873 computeKnownBits(I->getOperand(0), DemandedElts, Depth, Q);
2880 computeKnownBits(I->getOperand(1), DemandedElts, Depth, Q);
2898 return isNonZeroAdd(DemandedElts, Depth, Q, BitWidth, I->getOperand(0),
2899 I->getOperand(1), Q.IIQ.hasNoSignedWrap(BO),
2900 Q.IIQ.hasNoUnsignedWrap(BO));
2904 return isNonZeroMul(DemandedElts, Depth, Q, BitWidth, I->getOperand(0),
2905 I->getOperand(1), Q.IIQ.hasNoSignedWrap(BO),
2906 Q.IIQ.hasNoUnsignedWrap(BO));
2919 if (isKnownNonZero(Op, DemandedElts, Q, Depth))
2942 if (Q.IIQ.UseInstrInfo && isNonZeroRecurrence(PN))
2946 SimplifyQuery RecQ = Q.getWithoutCondContext();
2991 return (SkipElt || isKnownNonZero(Elt, Q, Depth)) &&
2993 isKnownNonZero(Vec, DemandedVecElts, Q, Depth));
3005 return isKnownNonZero(Vec, DemandedVecElts, Q, Depth);
3020 isKnownNonZero(Shuf->getOperand(1), DemandedRHS, Q, Depth)) &&
3022 isKnownNonZero(Shuf->getOperand(0), DemandedLHS, Q, Depth));
3025 return isKnownNonZero(I->getOperand(0), Q, Depth) &&
3026 isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
3033 if (Q.IIQ.getMetadata(LI, LLVMContext::MD_nonnull) ||
3034 (Q.IIQ.getMetadata(LI, LLVMContext::MD_dereferenceable) &&
3037 } else if (MDNode *Ranges = Q.IIQ.getMetadata(LI, LLVMContext::MD_range)) {
3052 return isNonZeroAdd(DemandedElts, Depth, Q, BitWidth,
3057 return isNonZeroSub(DemandedElts, Depth, Q, BitWidth,
3060 return isNonZeroMul(DemandedElts, Depth, Q, BitWidth,
3075 return isKnownNonZero(RP, Q, Depth);
3077 if (MDNode *Ranges = Q.IIQ.getMetadata(Call, LLVMContext::MD_range))
3085 if (RV->getType() == I->getType() && isKnownNonZero(RV, Q, Depth))
3097 return isKnownNonZero(II->getArgOperand(0), DemandedElts, Q, Depth);
3101 return isNonZeroSub(DemandedElts, Depth, Q, BitWidth,
3104 return isNonZeroAdd(DemandedElts, Depth, Q, BitWidth,
3110 Q, Depth);
3117 return isKnownNonZero(II->getArgOperand(0), Q, Depth);
3125 return isKnownNonZero(II->getArgOperand(1), DemandedElts, Q, Depth) ||
3126 isKnownNonZero(II->getArgOperand(0), DemandedElts, Q, Depth);
3134 isKnownNonZero(Op, DemandedElts, Q, Depth);
3140 computeKnownBits(II->getArgOperand(1), DemandedElts, Depth, Q);
3145 computeKnownBits(II->getArgOperand(0), DemandedElts, Depth, Q);
3156 computeKnownBits(II->getArgOperand(1), DemandedElts, Depth, Q);
3160 computeKnownBits(II->getArgOperand(0), DemandedElts, Depth, Q);
3169 return isKnownNonZero(II->getArgOperand(0), DemandedElts, Q, Depth) &&
3170 isKnownNonZero(II->getArgOperand(1), DemandedElts, Q, Depth);
3172 return computeKnownBits(II->getArgOperand(0), DemandedElts, Depth, Q)
3175 return computeKnownBits(II->getArgOperand(0), DemandedElts, Depth, Q)
3181 return isKnownNonZero(II->getArgOperand(0), DemandedElts, Q, Depth);
3186 return isKnownNonZero(I->getOperand(0), Q, Depth);
3198 computeKnownBits(I, DemandedElts, Known, Depth, Q);
3209 const SimplifyQuery &Q, unsigned Depth) {
3249 return isKnownNonZero(CPA->getPointer(), DemandedElts, Q, Depth);
3272 if (!isa<Constant>(V) && isKnownNonZeroFromAssume(V, Q))
3293 if (isKnownNonZeroFromOperator(I, DemandedElts, Depth, Q))
3297 isKnownNonNullFromDominatingCondition(V, Q.CxtI, Q.DT))
3303 bool llvm::isKnownNonZero(const Value *V, const SimplifyQuery &Q,
3308 return ::isKnownNonZero(V, DemandedElts, Q, Depth);
3436 const SimplifyQuery &Q) {
3456 return isKnownNonZero(Op, DemandedElts, Q, Depth + 1);
3465 const SimplifyQuery &Q) {
3471 isKnownNonZero(V1, DemandedElts, Q, Depth + 1);
3480 const SimplifyQuery &Q) {
3485 !C->isZero() && isKnownNonZero(V1, DemandedElts, Q, Depth + 1);
3492 const SimplifyQuery &Q) {
3512 SimplifyQuery RecQ = Q.getWithoutCondContext();
3523 const SimplifyQuery &Q) {
3533 DemandedElts, Depth + 1, Q) &&
3535 DemandedElts, Depth + 1, Q);
3537 return isKnownNonEqual(SI1->getTrueValue(), V2, DemandedElts, Depth + 1, Q) &&
3538 isKnownNonEqual(SI1->getFalseValue(), V2, DemandedElts, Depth + 1, Q);
3547 const SimplifyQuery &Q) {
3577 unsigned IndexWidth = Q.DL.getIndexTypeSizeInBits(Start->getType());
3579 Start = Start->stripAndAccumulateInBoundsConstantOffsets(Q.DL, StartOffset);
3581 Step = Step->stripAndAccumulateInBoundsConstantOffsets(Q.DL, StepOffset);
3587 B = B->stripAndAccumulateInBoundsConstantOffsets(Q.DL, OffsetB);
3596 const SimplifyQuery &Q) {
3614 Depth + 1, Q);
3620 if (isNonEqualPHIs(PN1, PN2, DemandedElts, Depth, Q))
3625 if (isModifyingBinopOfNonZero(V1, V2, DemandedElts, Depth, Q) ||
3626 isModifyingBinopOfNonZero(V2, V1, DemandedElts, Depth, Q))
3629 if (isNonEqualMul(V1, V2, DemandedElts, Depth, Q) ||
3630 isNonEqualMul(V2, V1, DemandedElts, Depth, Q))
3633 if (isNonEqualShl(V1, V2, DemandedElts, Depth, Q) ||
3634 isNonEqualShl(V2, V1, DemandedElts, Depth, Q))
3640 KnownBits Known1 = computeKnownBits(V1, DemandedElts, Depth, Q);
3642 KnownBits Known2 = computeKnownBits(V2, DemandedElts, Depth, Q);
3649 if (isNonEqualSelect(V1, V2, DemandedElts, Depth, Q) ||
3650 isNonEqualSelect(V2, V1, DemandedElts, Depth, Q))
3653 if (isNonEqualPointersWithRecursiveGEP(V1, V2, Q) ||
3654 isNonEqualPointersWithRecursiveGEP(V2, V1, Q))
3660 if (match(V1, m_PtrToIntSameSize(Q.DL, m_Value(A))) &&
3661 match(V2, m_PtrToIntSameSize(Q.DL, m_Value(B))))
3662 return isKnownNonEqual(A, B, DemandedElts, Depth + 1, Q);
3745 unsigned Depth, const SimplifyQuery &Q);
3748 unsigned Depth, const SimplifyQuery &Q) {
3749 unsigned Result = ComputeNumSignBitsImpl(V, DemandedElts, Depth, Q);
3763 unsigned Depth, const SimplifyQuery &Q) {
3784 Q.DL.getPointerTypeSizeInBits(ScalarTy) :
3785 Q.DL.getTypeSizeInBits(ScalarTy);
3801 return ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q) +
3815 ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3824 Tmp = ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3855 Tmp = ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3878 Tmp = ComputeNumSignBits(X, DemandedElts, Depth + 1, Q);
3882 ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3894 Tmp = ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3896 Tmp2 = ComputeNumSignBits(U->getOperand(1), DemandedElts, Depth + 1, Q);
3912 Tmp = ComputeNumSignBits(U->getOperand(1), DemandedElts, Depth + 1, Q);
3915 Tmp2 = ComputeNumSignBits(U->getOperand(2), DemandedElts, Depth + 1, Q);
3922 Tmp = ComputeNumSignBits(U->getOperand(0), Depth + 1, Q);
3929 computeKnownBits(U->getOperand(0), DemandedElts, Known, Depth + 1, Q);
3942 Tmp2 = ComputeNumSignBits(U->getOperand(1), DemandedElts, Depth + 1, Q);
3948 Tmp2 = ComputeNumSignBits(U->getOperand(1), DemandedElts, Depth + 1, Q);
3956 computeKnownBits(U->getOperand(1), DemandedElts, Known, Depth + 1, Q);
3973 Tmp = ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3982 ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
3986 ComputeNumSignBits(U->getOperand(1), DemandedElts, Depth + 1, Q);
4004 SimplifyQuery RecQ = Q.getWithoutCondContext();
4019 Tmp = ComputeNumSignBits(U->getOperand(0), Depth + 1, Q);
4032 return ComputeNumSignBits(U->getOperand(0), Depth + 1, Q);
4050 Tmp = ComputeNumSignBits(LHS, DemandedLHS, Depth + 1, Q);
4058 Tmp2 = ComputeNumSignBits(RHS, DemandedRHS, Depth + 1, Q);
4075 ComputeNumSignBits(U->getOperand(0), DemandedElts, Depth + 1, Q);
4103 computeKnownBits(V, DemandedElts, Known, Depth, Q);
4796 const SimplifyQuery &Q) {
4799 if (!Q.CxtI)
4802 if (Q.DC && Q.DT) {
4804 for (BranchInst *BI : Q.DC->conditionsFor(V)) {
4808 if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
4809 computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/true, Q.CxtI,
4813 if (Q.DT->dominates(Edge1, Q.CxtI->getParent()))
4814 computeKnownFPClassFromCond(V, Cond, /*CondIsTrue=*/false, Q.CxtI,
4819 if (!Q.AC)
4824 for (auto &AssumeVH : Q.AC->assumptionsFor(V)) {
4829 assert(I->getFunction() == Q.CxtI->getParent()->getParent() &&
4834 if (!isValidAssumeForContext(I, Q.CxtI, Q.DT))
4838 Q.CxtI, KnownFromContext);
4846 unsigned Depth, const SimplifyQuery &Q);
4850 const SimplifyQuery &Q) {
4854 computeKnownFPClass(V, DemandedElts, InterestedClasses, Known, Depth, Q);
4861 const SimplifyQuery &Q) {
4868 KnownSrc, Depth + 1, Q);
4882 unsigned Depth, const SimplifyQuery &Q) {
4964 KnownFPClass AssumedClasses = computeKnownFPClassFromContext(V, Q);
4992 Known, Depth + 1, Q);
5038 Depth + 1, Q);
5042 Known2, Depth + 1, Q);
5057 InterestedClasses, Known, Depth + 1, Q);
5067 Known, Depth + 1, Q);
5069 KnownSign, Depth + 1, Q);
5087 KnownAddend, Depth + 1, Q);
5101 KnownSrc, Depth + 1, Q);
5118 if (Q.IIQ.hasNoSignedZeros(II) ||
5129 KnownSrc, Depth + 1, Q);
5141 KnownLHS, Depth + 1, Q);
5143 KnownRHS, Depth + 1, Q);
5226 KnownSrc, Depth + 1, Q);
5277 InterestedClasses, Depth + 1, Q);
5287 II->getFastMathFlags(), InterestedClasses, Depth + 1, Q);
5303 KnownSrc, Depth + 1, Q);
5336 KnownSrc, Depth + 1, Q);
5346 Depth, Q);
5370 KnownSrc, Depth + 1, Q);
5393 ExponentKnownBits, Depth + 1, Q);
5410 KnownSrc, Depth + 1, Q);
5418 KnownSrc, Depth + 1, Q);
5444 ExpArg, true, Q.IIQ.UseInstrInfo, Q.AC, Q.CxtI, Q.DT, Depth + 1);
5477 Known, Depth + 1, Q);
5520 KnownRHS, Depth + 1, Q);
5529 KnownLHS, Depth + 1, Q);
5580 Depth + 1, Q);
5585 Depth + 1, Q);
5640 Depth + 1, Q);
5652 Depth + 1, Q);
5697 Known, Depth + 1, Q);
5720 Depth, Q);
5766 Depth + 1, Q);
5789 computeKnownFPClass(Elt, Known, InterestedClasses, Depth + 1, Q);
5801 Depth + 1, Q);
5818 Depth + 1, Q);
5831 Depth + 1, Q);
5850 InterestedClasses, KnownSrc, Depth + 1, Q);
5882 Q);
5914 Q.getWithoutCondContext().getWithInstruction(