Lines Matching defs:ConstantRange
26 #include "llvm/IR/ConstantRange.h"
364 std::optional<ConstantRange> getRangeFor(Value *V, Instruction *CxtI,
368 std::function<ConstantRange(const ConstantRange &, const ConstantRange &)>
547 if (std::optional<ConstantRange> Range = cast<CallBase>(BBI)->getRange())
671 if (std::optional<ConstantRange> Range = cast<Argument>(Val)->getRange())
808 const ConstantRange &TrueCR = TrueVal.asConstantRange(SI->getType());
809 const ConstantRange &FalseCR = FalseVal.asConstantRange(SI->getType());
818 ConstantRange ResultCR = [&]() {
847 ConstantRange Zero(APInt::getZero(TrueCR.getBitWidth()));
879 std::optional<ConstantRange>
907 std::optional<ConstantRange> LHSRes = getRangeFor(CI->getOperand(0), CI, BB);
911 const ConstantRange &LHSRange = *LHSRes;
915 // NOTE: We're currently limited by the set of operations that ConstantRange
925 std::function<ConstantRange(const ConstantRange &, const ConstantRange &)>
931 [&](Value *X, const ConstantRange &CRX, SelectInst *Y,
944 ConstantRange TrueX =
948 ConstantRange FalseX =
952 ConstantRange TrueY = TrueC->toConstantRange();
953 ConstantRange FalseY = FalseC->toConstantRange();
966 std::optional<ConstantRange> LHSRes = getRangeFor(LHS, I, BB);
976 std::optional<ConstantRange> RHSRes = getRangeFor(RHS, I, BB);
986 const ConstantRange &LHSRange = *LHSRes;
987 const ConstantRange &RHSRange = *RHSRes;
999 [BO, NoWrapKind](const ConstantRange &CR1, const ConstantRange &CR2) {
1005 BO, BB, [BO](const ConstantRange &CR1, const ConstantRange &CR2) {
1014 WO, BB, [WO](const ConstantRange &CR1, const ConstantRange &CR2) {
1022 if (!ConstantRange::isIntrinsicSupported(II->getIntrinsicID())) {
1028 SmallVector<ConstantRange, 2> OpRanges;
1030 std::optional<ConstantRange> Range = getRangeFor(Op, II, BB);
1037 ConstantRange::intrinsic(II->getIntrinsicID(), OpRanges))
1125 ConstantRange RHSRange(RHS->getType()->getScalarSizeInBits(),
1128 RHSRange = ConstantRange(CI->getValue());
1137 ConstantRange TrueValues =
1138 ConstantRange::makeAllowedICmpRegion(Pred, RHSRange);
1142 static std::optional<ConstantRange>
1144 function_ref<std::optional<ConstantRange>(const APInt &)> Fn) {
1171 ConstantRange ResValRange =
1172 ConstantRange::makeExactICmpRegion(Pred, RHSConst->getValue());
1180 ConstantRange::getNonEmpty(std::move(ValMin), ValMax + 1));
1229 ConstantRange::fromKnownBits(Known, /*IsSigned*/ false));
1234 ConstantRange::makeMaskNotEqualRange(*Mask, *C));
1244 ConstantRange CR = ConstantRange::makeExactICmpRegion(EdgePred, *C);
1246 return ValueLatticeElement::getRange(ConstantRange::getNonEmpty(
1258 EdgePred, *C, [&](const APInt &RHS) -> std::optional<ConstantRange> {
1262 return ConstantRange::getNonEmpty(
1298 ConstantRange NWR = ConstantRange::makeExactNoWrapRegion(
1385 return ValueLatticeElement::getRange(ConstantRange(C->getValue()));
1396 return ValueLatticeElement::getRange(ConstantRange(C->getValue()));
1400 return ValueLatticeElement::getRange(ConstantRange(OpConstVal));
1501 ConstantRange EdgesVals(BitWidth, DefaultCase/*isFullSet*/);
1505 ConstantRange EdgeVal(CaseValue);
1776 const ConstantRange &CR = Result.getConstantRange();
1783 ConstantRange LazyValueInfo::getConstantRange(Value *V, Instruction *CxtI,
1791 ConstantRange LazyValueInfo::getConstantRangeAtUse(const Use &U,
1811 const ConstantRange &CR = Result.getConstantRange();
1818 ConstantRange LazyValueInfo::getConstantRangeOnEdge(Value *V,
1838 const ConstantRange &CR = Val.getConstantRange();
1839 ConstantRange RHS = C->toConstantRange();