[PATCH] D72436: [SCEV] get a more accurate range for AddRecExpr with nsw flag
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 09:53:13 PST 2020
nikic added a comment.
Logic looks good to me. As @efriedma mentioned some extra tests would be good, especially for the different sign cases. The current test only covers negative start with negative step.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5702
+ ConstantRange(SignedMin, APInt::getSignedMinValue(BitWidth)),
+ RangeType);
+ } else if (AllNonPos) {
----------------
It's possible to use `getNonEmpty()` to avoid the explicit check for signed-min / signed-max:
```
ConservativeResult = ConservativeResult.intersectWith(
ConstantRange::getNonEmpty(getSignedRangeMin(AddRec->getStart()),
APInt::getSignedMinValue(BitWidth)),
RangeType);
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72436/new/
https://reviews.llvm.org/D72436
More information about the llvm-commits
mailing list