[PATCH] D64869: [SCEV] get more accurate range for AddExpr with NW flag
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 10:09:19 PDT 2019
reames added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5568
if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(S)) {
- ConstantRange X = getRangeRef(Add->getOperand(0), SignHint);
- for (unsigned i = 1, e = Add->getNumOperands(); i != e; ++i)
- X = X.add(getRangeRef(Add->getOperand(i), SignHint));
+ ConstantRange X(BitWidth, /*isFullSet=*/true);
+ if (maskFlags(Add->getNoWrapFlags(), SCEV::FlagNSW) == SCEV::FlagNSW) {
----------------
nikic wrote:
> reames wrote:
> > Stylistically, it would be much cleaner to add a function to ConstantRange with the signature
> > CR add(CR, NoWrapKind)
> I was planning to add this ConstantRange functionality based on D61653.
That looks entirely reasonable. Land that, and rebase?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64869/new/
https://reviews.llvm.org/D64869
More information about the llvm-commits
mailing list