@@ -151,7 +151,7 @@ class InductiveRangeCheck {
151
151
152
152
const SCEV *Offset = nullptr ;
153
153
const SCEV *Scale = nullptr ;
154
- Value *Length = nullptr ;
154
+ const SCEV *Length = nullptr ;
155
155
Use *CheckUse = nullptr ;
156
156
RangeCheckKind Kind = RANGE_CHECK_UNKNOWN;
157
157
bool IsSigned = true ;
@@ -168,7 +168,7 @@ class InductiveRangeCheck {
168
168
public:
169
169
const SCEV *getOffset () const { return Offset; }
170
170
const SCEV *getScale () const { return Scale; }
171
- Value *getLength () const { return Length; }
171
+ const SCEV *getLength () const { return Length; }
172
172
bool isSigned () const { return IsSigned; }
173
173
174
174
void print (raw_ostream &OS) const {
@@ -419,7 +419,7 @@ void InductiveRangeCheck::extractRangeChecksFromCond(
419
419
return ;
420
420
421
421
InductiveRangeCheck IRC;
422
- IRC.Length = Length;
422
+ IRC.Length = Length ? SE. getSCEV (Length) : nullptr ;
423
423
IRC.Offset = IndexAddRec->getStart ();
424
424
IRC.Scale = IndexAddRec->getStepRecurrence (SE);
425
425
IRC.CheckUse = &ConditionUse;
@@ -1660,9 +1660,9 @@ InductiveRangeCheck::computeSafeIterationSpace(
1660
1660
1661
1661
// We strengthen "0 <= I" to "0 <= I < INT_SMAX" and "I < L" to "0 <= I < L".
1662
1662
// We can potentially do much better here.
1663
- if (Value *V = getLength ()) {
1664
- UpperLimit = SE. getSCEV (V) ;
1665
- } else {
1663
+ if (const SCEV *L = getLength ())
1664
+ UpperLimit = L ;
1665
+ else {
1666
1666
assert (Kind == InductiveRangeCheck::RANGE_CHECK_LOWER && " invariant!" );
1667
1667
unsigned BitWidth = cast<IntegerType>(IndVar->getType ())->getBitWidth ();
1668
1668
UpperLimit = SE.getConstant (APInt::getSignedMaxValue (BitWidth));
0 commit comments