Lines Matching refs:Range
11 // the middle loop provably does not need range checks. As an example, it will
79 static cl::opt<bool> PrintRangeChecks("irce-print-range-checks", cl::Hidden,
89 /// An inductive range check is conditional branch in a loop with
96 /// 2. a condition that is provably true for some contiguous range of values
100 // Classifies a range check
102 // Range check of the form "0 <= I".
105 // Range check of the form "I < L" where L is known positive.
112 // Unrecognized range check condition.
163 /// Represents an signed integer range [Range.getBegin(), Range.getEnd()). If
164 /// R.getEnd() sle R.getBegin(), then R denotes the empty range.
166 class Range {
171 Range(const SCEV *Begin, const SCEV *End) : Begin(Begin), End(End) {
172 assert(Begin->getType() == End->getType() && "ill-typed range!");
184 /// Computes a range for the induction variable (IndVar) in which the range
187 Optional<Range> computeSafeIterationSpace(ScalarEvolution &SE,
190 /// Parse out a set of inductive range checks from \p BI and append them to \p
193 /// NB! There may be conditions feeding into \p BI that aren't inductive range
221 "Inductive range check elimination", false, false)
225 "Inductive range check elimination", false, false)
243 llvm_unreachable("unknown range check type!");
246 /// Parse a single ICmp instruction, `ICI`, into a range check. If `ICI` cannot
247 /// be interpreted as a range check, return `RANGE_CHECK_UNKNOWN` and set
249 /// range checked, and set `Length` to the upper limit `Index` is being range
250 /// checked with if (and only if) the range check type is stronger or equal to
337 // checking the upper and lower bounds into a full range check.
454 /// The algorithm this class implements is given a Loop and a range [Begin,
475 // Result of rewriting the range of a loop. See changeIterationSpaceEnd for
506 // intersection of `Range' and the iteration space of the original loop.
580 // The range we need to run the main loop in.
581 InductiveRangeCheck::Range Range;
589 ScalarEvolution &SE, InductiveRangeCheck::Range R)
592 OriginalPreheader(nullptr), MainLoopPreheader(nullptr), Range(R),
832 if (Range.getType() != Ty)
847 // range of values the induction variable takes.
868 // will be an empty range. Returning an empty range is always safe.
882 SE.isKnownPredicate(ICmpInst::ICMP_SLE, Range.getBegin(), Smallest);
884 Result.LowLimit = Clamp(Range.getBegin());
887 SE.isKnownPredicate(ICmpInst::ICMP_SLE, Greatest, Range.getEnd());
889 Result.HighLimit = Clamp(Range.getEnd());
1275 /// Computes and returns a range of values for the induction variable (IndVar)
1276 /// in which the range check can be safely elided. If it cannot compute such a
1277 /// range, returns None.
1278 Optional<InductiveRangeCheck::Range>
1283 // this inductive range check is a range check on the "C + D * I" ("C" is
1284 // getOffset() and "D" is getScale()). We rewrite the value being range
1342 return InductiveRangeCheck::Range(Begin, End);
1345 static Optional<InductiveRangeCheck::Range>
1347 const Optional<InductiveRangeCheck::Range> &R1,
1348 const InductiveRangeCheck::Range &R2) {
1353 // TODO: we could widen the smaller range and have this work; but for now we
1361 return InductiveRangeCheck::Range(NewBegin, NewEnd);
1396 << " inductive range checks: \n";
1421 Optional<InductiveRangeCheck::Range> SafeIterRange;
1459 // Optimize away the now-redundant range checks.