Lines Matching refs:KnownZero
122 static void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
125 void llvm::computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne, in computeKnownBits() argument
129 ::computeKnownBits(V, KnownZero, KnownOne, Depth, in computeKnownBits()
148 static void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
151 void llvm::ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne, in ComputeSignBit() argument
155 ::ComputeSignBit(V, KnownZero, KnownOne, Depth, in ComputeSignBit()
236 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsAddSub() argument
245 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsAddSub()
257 KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2); in computeKnownBitsAddSub()
263 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsAddSub()
296 KnownZero = ~PossibleSumOne & Known; in computeKnownBitsAddSub()
305 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsAddSub()
315 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsMul() argument
318 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsMul()
319 computeKnownBits(Op1, KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsMul()
330 bool isKnownNonNegativeOp1 = KnownZero.isNegative(); in computeKnownBitsMul()
352 unsigned TrailZ = KnownZero.countTrailingOnes() + in computeKnownBitsMul()
354 unsigned LeadZ = std::max(KnownZero.countLeadingOnes() + in computeKnownBitsMul()
360 KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) | in computeKnownBitsMul()
369 KnownZero.setBit(BitWidth - 1); in computeKnownBitsMul()
370 else if (isKnownNegative && !KnownZero.isNegative()) in computeKnownBitsMul()
375 APInt &KnownZero, in computeKnownBitsFromRangeMetadata() argument
377 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromRangeMetadata()
381 KnownZero.setAllBits(); in computeKnownBitsFromRangeMetadata()
397 KnownZero &= ~Range.getUnsignedMax() & Mask; in computeKnownBitsFromRangeMetadata()
519 static void computeKnownBitsFromAssume(Value *V, APInt &KnownZero, in computeKnownBitsFromAssume() argument
527 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromAssume()
549 KnownZero.clearAllBits(); in computeKnownBitsFromAssume()
570 KnownZero |= RHSKnownZero; in computeKnownBitsFromAssume()
584 KnownZero |= RHSKnownZero & MaskKnownOne; in computeKnownBitsFromAssume()
598 KnownZero |= RHSKnownOne & MaskKnownOne; in computeKnownBitsFromAssume()
612 KnownZero |= RHSKnownZero & BKnownZero; in computeKnownBitsFromAssume()
626 KnownZero |= RHSKnownOne & BKnownZero; in computeKnownBitsFromAssume()
641 KnownZero |= RHSKnownZero & BKnownZero; in computeKnownBitsFromAssume()
643 KnownZero |= RHSKnownOne & BKnownOne; in computeKnownBitsFromAssume()
658 KnownZero |= RHSKnownOne & BKnownZero; in computeKnownBitsFromAssume()
660 KnownZero |= RHSKnownZero & BKnownOne; in computeKnownBitsFromAssume()
671 KnownZero |= RHSKnownZero.lshr(C->getZExtValue()); in computeKnownBitsFromAssume()
682 KnownZero |= RHSKnownOne.lshr(C->getZExtValue()); in computeKnownBitsFromAssume()
695 KnownZero |= RHSKnownZero << C->getZExtValue(); in computeKnownBitsFromAssume()
708 KnownZero |= RHSKnownOne << C->getZExtValue(); in computeKnownBitsFromAssume()
719 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsFromAssume()
730 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsFromAssume()
762 KnownZero |= in computeKnownBitsFromAssume()
774 KnownZero |= in computeKnownBitsFromAssume()
777 KnownZero |= in computeKnownBitsFromAssume()
793 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsFromShiftOperator() argument
796 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromShiftOperator()
801 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromShiftOperator()
802 KnownZero = KZF(KnownZero, ShiftAmt); in computeKnownBitsFromShiftOperator()
807 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromShiftOperator()
812 uint64_t ShiftAmtKZ = KnownZero.zextOrTrunc(64).getZExtValue(); in computeKnownBitsFromShiftOperator()
817 KnownZero.clearAllBits(); in computeKnownBitsFromShiftOperator()
835 KnownZero = KnownOne = APInt::getAllOnesValue(BitWidth); in computeKnownBitsFromShiftOperator()
854 KnownZero &= KZF(KnownZero2, ShiftAmt); in computeKnownBitsFromShiftOperator()
863 if ((KnownZero & KnownOne) != 0) { in computeKnownBitsFromShiftOperator()
864 KnownZero.clearAllBits(); in computeKnownBitsFromShiftOperator()
869 static void computeKnownBitsFromOperator(Operator *I, APInt &KnownZero, in computeKnownBitsFromOperator() argument
872 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromOperator()
874 APInt KnownZero2(KnownZero), KnownOne2(KnownOne); in computeKnownBitsFromOperator()
879 computeKnownBitsFromRangeMetadata(*MD, KnownZero, KnownOne); in computeKnownBitsFromOperator()
883 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
889 KnownZero |= KnownZero2; in computeKnownBitsFromOperator()
904 KnownZero |= APInt::getLowBitsSet(BitWidth, 1); in computeKnownBitsFromOperator()
909 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
913 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
919 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
923 APInt KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2); in computeKnownBitsFromOperator()
925 KnownOne = (KnownZero & KnownOne2) | (KnownOne & KnownZero2); in computeKnownBitsFromOperator()
926 KnownZero = KnownZeroOut; in computeKnownBitsFromOperator()
931 computeKnownBitsMul(I->getOperand(0), I->getOperand(1), NSW, KnownZero, in computeKnownBitsFromOperator()
950 KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ); in computeKnownBitsFromOperator()
954 computeKnownBits(I->getOperand(2), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
959 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
982 KnownZero = KnownZero.zextOrTrunc(SrcBitWidth); in computeKnownBitsFromOperator()
984 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
985 KnownZero = KnownZero.zextOrTrunc(BitWidth); in computeKnownBitsFromOperator()
989 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth); in computeKnownBitsFromOperator()
998 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
1007 KnownZero = KnownZero.trunc(SrcBitWidth); in computeKnownBitsFromOperator()
1009 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
1010 KnownZero = KnownZero.zext(BitWidth); in computeKnownBitsFromOperator()
1015 if (KnownZero[SrcBitWidth-1]) // Input sign bit known zero in computeKnownBitsFromOperator()
1016 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth); in computeKnownBitsFromOperator()
1023 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1024 return (KnownZero << ShiftAmt) | in computeKnownBitsFromOperator()
1032 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1039 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1040 return APIntOps::lshr(KnownZero, ShiftAmt) | in computeKnownBitsFromOperator()
1049 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1056 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1057 return APIntOps::ashr(KnownZero, ShiftAmt); in computeKnownBitsFromOperator()
1064 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1072 KnownZero, KnownOne, KnownZero2, KnownOne2, Depth, in computeKnownBitsFromOperator()
1079 KnownZero, KnownOne, KnownZero2, KnownOne2, Depth, in computeKnownBitsFromOperator()
1092 KnownZero = KnownZero2 & LowBits; in computeKnownBitsFromOperator()
1098 KnownZero |= ~LowBits; in computeKnownBitsFromOperator()
1105 assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); in computeKnownBitsFromOperator()
1111 if (KnownZero.isNonNegative()) { in computeKnownBitsFromOperator()
1117 KnownZero.setBit(BitWidth - 1); in computeKnownBitsFromOperator()
1126 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
1127 KnownZero |= ~LowBits; in computeKnownBitsFromOperator()
1135 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBitsFromOperator()
1138 unsigned Leaders = std::max(KnownZero.countLeadingOnes(), in computeKnownBitsFromOperator()
1141 KnownZero = APInt::getHighBitsSet(BitWidth, Leaders); in computeKnownBitsFromOperator()
1152 KnownZero = APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align)); in computeKnownBitsFromOperator()
1199 KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ); in computeKnownBitsFromOperator()
1237 APInt KnownZero3(KnownZero), KnownOne3(KnownOne); in computeKnownBitsFromOperator()
1240 KnownZero = APInt::getLowBitsSet(BitWidth, in computeKnownBitsFromOperator()
1254 if (Depth < MaxDepth - 1 && !KnownZero && !KnownOne) { in computeKnownBitsFromOperator()
1259 KnownZero = APInt::getAllOnesValue(BitWidth); in computeKnownBitsFromOperator()
1270 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
1274 if (!KnownZero && !KnownOne) in computeKnownBitsFromOperator()
1286 computeKnownBitsFromRangeMetadata(*MD, KnownZero, KnownOne); in computeKnownBitsFromOperator()
1289 KnownZero |= KnownZero2; in computeKnownBitsFromOperator()
1297 KnownZero |= KnownZero2.byteSwap(); in computeKnownBitsFromOperator()
1306 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - LowBits); in computeKnownBitsFromOperator()
1317 KnownZero |= APInt::getHighBitsSet(BitWidth, LeadingZeros); in computeKnownBitsFromOperator()
1318 KnownOne &= ~KnownZero; in computeKnownBitsFromOperator()
1324 KnownZero |= APInt::getHighBitsSet(64, 32); in computeKnownBitsFromOperator()
1339 II->getArgOperand(1), false, KnownZero, in computeKnownBitsFromOperator()
1345 II->getArgOperand(1), false, KnownZero, in computeKnownBitsFromOperator()
1351 KnownZero, KnownOne, KnownZero2, KnownOne2, Depth, in computeKnownBitsFromOperator()
1375 void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne, in computeKnownBits() argument
1379 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBits()
1387 KnownZero.getBitWidth() == BitWidth && in computeKnownBits()
1394 KnownZero = ~KnownOne; in computeKnownBits()
1400 KnownZero = APInt::getAllOnesValue(BitWidth); in computeKnownBits()
1408 KnownZero.setAllBits(); KnownOne.setAllBits(); in computeKnownBits()
1409 APInt Elt(KnownZero.getBitWidth(), 0); in computeKnownBits()
1412 KnownZero &= ~Elt; in computeKnownBits()
1421 KnownZero.setAllBits(); KnownOne.setAllBits(); in computeKnownBits()
1422 APInt Elt(KnownZero.getBitWidth(), 0); in computeKnownBits()
1427 KnownZero.clearAllBits(); in computeKnownBits()
1432 KnownZero &= ~Elt; in computeKnownBits()
1439 KnownZero.clearAllBits(); KnownOne.clearAllBits(); in computeKnownBits()
1450 computeKnownBits(GA->getAliasee(), KnownZero, KnownOne, Depth + 1, Q); in computeKnownBits()
1455 computeKnownBitsFromOperator(I, KnownZero, KnownOne, Depth, Q); in computeKnownBits()
1461 KnownZero |= APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align)); in computeKnownBits()
1468 computeKnownBitsFromAssume(V, KnownZero, KnownOne, Depth, Q); in computeKnownBits()
1470 assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); in computeKnownBits()
1475 void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne, in ComputeSignBit() argument
1479 KnownZero = false; in ComputeSignBit()
1487 KnownZero = ZeroBits[BitWidth - 1]; in ComputeSignBit()
1739 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1741 computeKnownBits(X, KnownZero, KnownOne, Depth, Q); in isKnownNonZero()
1762 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1764 computeKnownBits(X, KnownZero, KnownOne, Depth, Q); in isKnownNonZero()
1771 if (KnownZero.countTrailingOnes() >= ShiftVal) in isKnownNonZero()
1795 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1800 computeKnownBits(X, KnownZero, KnownOne, Depth, Q); in isKnownNonZero()
1805 computeKnownBits(Y, KnownZero, KnownOne, Depth, Q); in isKnownNonZero()
1861 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1863 computeKnownBits(V, KnownZero, KnownOne, Depth, Q); in isKnownNonZero()
1921 APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0); in MaskedValueIsZero() local
1922 computeKnownBits(V, KnownZero, KnownOne, Depth, Q); in MaskedValueIsZero()
1923 return (KnownZero & Mask) == Mask; in MaskedValueIsZero()
2081 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2082 computeKnownBits(U->getOperand(0), KnownZero, KnownOne, Depth + 1, Q); in ComputeNumSignBits()
2086 if ((KnownZero | APInt(TyBits, 1)).isAllOnesValue()) in ComputeNumSignBits()
2091 if (KnownZero.isNegative()) in ComputeNumSignBits()
2106 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2107 computeKnownBits(U->getOperand(1), KnownZero, KnownOne, Depth + 1, Q); in ComputeNumSignBits()
2110 if ((KnownZero | APInt(TyBits, 1)).isAllOnesValue()) in ComputeNumSignBits()
2115 if (KnownZero.isNegative()) in ComputeNumSignBits()
2160 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2161 computeKnownBits(V, KnownZero, KnownOne, Depth, Q); in ComputeNumSignBits()
2165 if (KnownZero.isNegative()) in ComputeNumSignBits()
2166 return std::max(FirstAnswer, KnownZero.countLeadingOnes()); in ComputeNumSignBits()
3997 APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0); in isTruePredicate() local
3998 computeKnownBits(X, KnownZero, KnownOne, DL, Depth + 1, AC, CxtI, DT); in isTruePredicate()
4000 if ((KnownZero & *CA) == *CA && (KnownZero & *CB) == *CB) in isTruePredicate()