[PATCH] D64869: [SCEV] get more accurate range for AddExpr with NW flag
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 09:57:38 PDT 2019
nikic 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) {
----------------
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64869/new/
https://reviews.llvm.org/D64869
More information about the llvm-commits
mailing list