Lines Matching refs:KnownZero
130 static void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
134 void llvm::computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne, in computeKnownBits() argument
138 ::computeKnownBits(V, KnownZero, KnownOne, DL, Depth, in computeKnownBits()
157 static void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
161 void llvm::ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne, in ComputeSignBit() argument
165 ::ComputeSignBit(V, KnownZero, KnownOne, DL, Depth, in ComputeSignBit()
229 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsAddSub() argument
239 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsAddSub()
251 KnownZero = APInt::getHighBitsSet(BitWidth, NLZ2); in computeKnownBitsAddSub()
257 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsAddSub()
290 KnownZero = ~PossibleSumOne & Known; in computeKnownBitsAddSub()
299 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsAddSub()
309 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsMul() argument
313 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsMul()
314 computeKnownBits(Op1, KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsMul()
325 bool isKnownNonNegativeOp1 = KnownZero.isNegative(); in computeKnownBitsMul()
347 unsigned TrailZ = KnownZero.countTrailingOnes() + in computeKnownBitsMul()
349 unsigned LeadZ = std::max(KnownZero.countLeadingOnes() + in computeKnownBitsMul()
355 KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ) | in computeKnownBitsMul()
364 KnownZero.setBit(BitWidth - 1); in computeKnownBitsMul()
365 else if (isKnownNegative && !KnownZero.isNegative()) in computeKnownBitsMul()
370 APInt &KnownZero, in computeKnownBitsFromRangeMetadata() argument
372 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromRangeMetadata()
376 KnownZero.setAllBits(); in computeKnownBitsFromRangeMetadata()
392 KnownZero &= ~Range.getUnsignedMax() & Mask; in computeKnownBitsFromRangeMetadata()
546 APInt &KnownZero, in computeKnownBitsFromTrueCondition() argument
558 const unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromTrueCondition()
573 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsFromTrueCondition()
586 KnownZero |= KnownZeroTemp; in computeKnownBitsFromTrueCondition()
596 KnownZero |= APInt::getHighBitsSet(BitWidth, SignBits); in computeKnownBitsFromTrueCondition()
608 KnownZero |= APInt::getHighBitsSet(BitWidth, SignBits); in computeKnownBitsFromTrueCondition()
619 static void computeKnownBitsFromDominatingCondition(Value *V, APInt &KnownZero, in computeKnownBitsFromDominatingCondition() argument
687 computeKnownBitsFromTrueCondition(V, Cmp, KnownZero, KnownOne, DL, Depth, in computeKnownBitsFromDominatingCondition()
721 computeKnownBitsFromTrueCondition(V, Cmp, KnownZero, KnownOne, DL, Depth, in computeKnownBitsFromDominatingCondition()
727 static void computeKnownBitsFromAssume(Value *V, APInt &KnownZero, in computeKnownBitsFromAssume() argument
735 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromAssume()
757 KnownZero.clearAllBits(); in computeKnownBitsFromAssume()
778 KnownZero |= RHSKnownZero; in computeKnownBitsFromAssume()
791 KnownZero |= RHSKnownZero & MaskKnownOne; in computeKnownBitsFromAssume()
804 KnownZero |= RHSKnownOne & MaskKnownOne; in computeKnownBitsFromAssume()
817 KnownZero |= RHSKnownZero & BKnownZero; in computeKnownBitsFromAssume()
830 KnownZero |= RHSKnownOne & BKnownZero; in computeKnownBitsFromAssume()
844 KnownZero |= RHSKnownZero & BKnownZero; in computeKnownBitsFromAssume()
846 KnownZero |= RHSKnownOne & BKnownOne; in computeKnownBitsFromAssume()
860 KnownZero |= RHSKnownOne & BKnownZero; in computeKnownBitsFromAssume()
862 KnownZero |= RHSKnownZero & BKnownOne; in computeKnownBitsFromAssume()
872 KnownZero |= RHSKnownZero.lshr(C->getZExtValue()); in computeKnownBitsFromAssume()
882 KnownZero |= RHSKnownOne.lshr(C->getZExtValue()); in computeKnownBitsFromAssume()
894 KnownZero |= RHSKnownZero << C->getZExtValue(); in computeKnownBitsFromAssume()
906 KnownZero |= RHSKnownOne << C->getZExtValue(); in computeKnownBitsFromAssume()
916 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsFromAssume()
926 KnownZero |= APInt::getSignBit(BitWidth); in computeKnownBitsFromAssume()
955 KnownZero |= in computeKnownBitsFromAssume()
966 KnownZero |= in computeKnownBitsFromAssume()
969 KnownZero |= in computeKnownBitsFromAssume()
985 APInt &KnownZero, APInt &KnownOne, in computeKnownBitsFromShiftOperator() argument
989 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromShiftOperator()
994 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromShiftOperator()
995 KnownZero = KZF(KnownZero, ShiftAmt); in computeKnownBitsFromShiftOperator()
1000 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromShiftOperator()
1005 uint64_t ShiftAmtKZ = KnownZero.zextOrTrunc(64).getZExtValue(); in computeKnownBitsFromShiftOperator()
1010 KnownZero.clearAllBits(), KnownOne.clearAllBits(); in computeKnownBitsFromShiftOperator()
1027 KnownZero = KnownOne = APInt::getAllOnesValue(BitWidth); in computeKnownBitsFromShiftOperator()
1046 KnownZero &= KZF(KnownZero2, ShiftAmt); in computeKnownBitsFromShiftOperator()
1055 if ((KnownZero & KnownOne) != 0) in computeKnownBitsFromShiftOperator()
1056 KnownZero.clearAllBits(), KnownOne.clearAllBits(); in computeKnownBitsFromShiftOperator()
1059 static void computeKnownBitsFromOperator(Operator *I, APInt &KnownZero, in computeKnownBitsFromOperator() argument
1062 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBitsFromOperator()
1064 APInt KnownZero2(KnownZero), KnownOne2(KnownOne); in computeKnownBitsFromOperator()
1069 computeKnownBitsFromRangeMetadata(*MD, KnownZero, KnownOne); in computeKnownBitsFromOperator()
1073 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1079 KnownZero |= KnownZero2; in computeKnownBitsFromOperator()
1094 KnownZero |= APInt::getLowBitsSet(BitWidth, 1); in computeKnownBitsFromOperator()
1099 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1103 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
1109 computeKnownBits(I->getOperand(1), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1113 APInt KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2); in computeKnownBitsFromOperator()
1115 KnownOne = (KnownZero & KnownOne2) | (KnownOne & KnownZero2); in computeKnownBitsFromOperator()
1116 KnownZero = KnownZeroOut; in computeKnownBitsFromOperator()
1121 computeKnownBitsMul(I->getOperand(0), I->getOperand(1), NSW, KnownZero, in computeKnownBitsFromOperator()
1140 KnownZero = APInt::getHighBitsSet(BitWidth, LeadZ); in computeKnownBitsFromOperator()
1144 computeKnownBits(I->getOperand(2), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1149 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
1172 KnownZero = KnownZero.zextOrTrunc(SrcBitWidth); in computeKnownBitsFromOperator()
1174 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1175 KnownZero = KnownZero.zextOrTrunc(BitWidth); in computeKnownBitsFromOperator()
1179 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth); in computeKnownBitsFromOperator()
1189 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1198 KnownZero = KnownZero.trunc(SrcBitWidth); in computeKnownBitsFromOperator()
1200 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1201 KnownZero = KnownZero.zext(BitWidth); in computeKnownBitsFromOperator()
1206 if (KnownZero[SrcBitWidth-1]) // Input sign bit known zero in computeKnownBitsFromOperator()
1207 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth); in computeKnownBitsFromOperator()
1214 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1215 return (KnownZero << ShiftAmt) | in computeKnownBitsFromOperator()
1223 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1230 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1231 return APIntOps::lshr(KnownZero, ShiftAmt) | in computeKnownBitsFromOperator()
1240 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1247 auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { in computeKnownBitsFromOperator() argument
1248 return APIntOps::ashr(KnownZero, ShiftAmt); in computeKnownBitsFromOperator()
1255 computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, in computeKnownBitsFromOperator()
1263 KnownZero, KnownOne, KnownZero2, KnownOne2, DL, in computeKnownBitsFromOperator()
1270 KnownZero, KnownOne, KnownZero2, KnownOne2, DL, in computeKnownBitsFromOperator()
1283 KnownZero = KnownZero2 & LowBits; in computeKnownBitsFromOperator()
1289 KnownZero |= ~LowBits; in computeKnownBitsFromOperator()
1296 assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); in computeKnownBitsFromOperator()
1302 if (KnownZero.isNonNegative()) { in computeKnownBitsFromOperator()
1308 KnownZero.setBit(BitWidth - 1); in computeKnownBitsFromOperator()
1317 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, in computeKnownBitsFromOperator()
1319 KnownZero |= ~LowBits; in computeKnownBitsFromOperator()
1327 computeKnownBits(I->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBitsFromOperator()
1330 unsigned Leaders = std::max(KnownZero.countLeadingOnes(), in computeKnownBitsFromOperator()
1333 KnownZero = APInt::getHighBitsSet(BitWidth, Leaders); in computeKnownBitsFromOperator()
1344 KnownZero = APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align)); in computeKnownBitsFromOperator()
1392 KnownZero = APInt::getLowBitsSet(BitWidth, TrailZ); in computeKnownBitsFromOperator()
1430 APInt KnownZero3(KnownZero), KnownOne3(KnownOne); in computeKnownBitsFromOperator()
1433 KnownZero = APInt::getLowBitsSet(BitWidth, in computeKnownBitsFromOperator()
1447 if (Depth < MaxDepth - 1 && !KnownZero && !KnownOne) { in computeKnownBitsFromOperator()
1452 KnownZero = APInt::getAllOnesValue(BitWidth); in computeKnownBitsFromOperator()
1464 KnownZero &= KnownZero2; in computeKnownBitsFromOperator()
1468 if (!KnownZero && !KnownOne) in computeKnownBitsFromOperator()
1477 computeKnownBitsFromRangeMetadata(*MD, KnownZero, KnownOne); in computeKnownBitsFromOperator()
1487 KnownZero |= KnownZero2.byteSwap(); in computeKnownBitsFromOperator()
1496 KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - LowBits); in computeKnownBitsFromOperator()
1508 KnownZero |= APInt::getHighBitsSet(BitWidth, LeadingZeros); in computeKnownBitsFromOperator()
1509 KnownOne &= ~KnownZero; in computeKnownBitsFromOperator()
1517 KnownZero |= APInt::getSplat(Ty->getPrimitiveSizeInBits(), SignBit); in computeKnownBitsFromOperator()
1521 KnownZero |= APInt::getHighBitsSet(64, 32); in computeKnownBitsFromOperator()
1536 II->getArgOperand(1), false, KnownZero, in computeKnownBitsFromOperator()
1542 II->getArgOperand(1), false, KnownZero, in computeKnownBitsFromOperator()
1548 KnownZero, KnownOne, KnownZero2, KnownOne2, DL, in computeKnownBitsFromOperator()
1612 void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne, in computeKnownBits() argument
1616 unsigned BitWidth = KnownZero.getBitWidth(); in computeKnownBits()
1625 KnownZero.getBitWidth() == BitWidth && in computeKnownBits()
1632 KnownZero = ~KnownOne; in computeKnownBits()
1639 KnownZero = APInt::getAllOnesValue(BitWidth); in computeKnownBits()
1648 KnownZero.setAllBits(); KnownOne.setAllBits(); in computeKnownBits()
1649 APInt Elt(KnownZero.getBitWidth(), 0); in computeKnownBits()
1652 KnownZero &= ~Elt; in computeKnownBits()
1659 KnownZero.clearAllBits(); KnownOne.clearAllBits(); in computeKnownBits()
1670 computeKnownBits(GA->getAliasee(), KnownZero, KnownOne, DL, Depth + 1, Q); in computeKnownBits()
1675 computeKnownBitsFromOperator(I, KnownZero, KnownOne, DL, Depth, Q); in computeKnownBits()
1681 KnownZero |= APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align)); in computeKnownBits()
1689 computeKnownBitsFromAssume(V, KnownZero, KnownOne, DL, Depth, Q); in computeKnownBits()
1694 computeKnownBitsFromDominatingCondition(V, KnownZero, KnownOne, DL, Depth, in computeKnownBits()
1697 assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); in computeKnownBits()
1702 void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne, in ComputeSignBit() argument
1706 KnownZero = false; in ComputeSignBit()
1714 KnownZero = ZeroBits[BitWidth - 1]; in ComputeSignBit()
1953 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1955 computeKnownBits(X, KnownZero, KnownOne, DL, Depth, Q); in isKnownNonZero()
1976 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
1978 computeKnownBits(X, KnownZero, KnownOne, DL, Depth, Q); in isKnownNonZero()
1985 if (KnownZero.countTrailingOnes() >= ShiftVal) in isKnownNonZero()
2009 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
2014 computeKnownBits(X, KnownZero, KnownOne, DL, Depth, Q); in isKnownNonZero()
2019 computeKnownBits(Y, KnownZero, KnownOne, DL, Depth, Q); in isKnownNonZero()
2069 APInt KnownZero(BitWidth, 0); in isKnownNonZero() local
2071 computeKnownBits(V, KnownZero, KnownOne, DL, Depth, Q); in isKnownNonZero()
2131 APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0); in MaskedValueIsZero() local
2132 computeKnownBits(V, KnownZero, KnownOne, DL, Depth, Q); in MaskedValueIsZero()
2133 return (KnownZero & Mask) == Mask; in MaskedValueIsZero()
2269 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2270 computeKnownBits(U->getOperand(0), KnownZero, KnownOne, DL, Depth + 1, in ComputeNumSignBits()
2275 if ((KnownZero | APInt(TyBits, 1)).isAllOnesValue()) in ComputeNumSignBits()
2280 if (KnownZero.isNegative()) in ComputeNumSignBits()
2295 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2296 computeKnownBits(U->getOperand(1), KnownZero, KnownOne, DL, Depth + 1, in ComputeNumSignBits()
2300 if ((KnownZero | APInt(TyBits, 1)).isAllOnesValue()) in ComputeNumSignBits()
2305 if (KnownZero.isNegative()) in ComputeNumSignBits()
2344 APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); in ComputeNumSignBits() local
2346 computeKnownBits(V, KnownZero, KnownOne, DL, Depth, Q); in ComputeNumSignBits()
2348 if (KnownZero.isNegative()) { // sign bit is 0 in ComputeNumSignBits()
2349 Mask = KnownZero; in ComputeNumSignBits()
4143 APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0); in isTruePredicate() local
4144 computeKnownBits(X, KnownZero, KnownOne, DL, Depth + 1, AC, CxtI, DT); in isTruePredicate()
4146 if ((KnownZero & *CA) == *CA && (KnownZero & *CB) == *CB) in isTruePredicate()