[PATCH] D89381: [SCEV] Re-enable "Use nw flag and symbolic iteration count to sharpen ranges of AddRecs", attempt 3
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 27 10:23:03 PDT 2020
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LG for landing under the flag.
I already landed a couple of SCEV improvements on Sunday that improved compile-time (while also improving nowrap inference), and am still pursuing some more leads, so I hope we can drop the flag in the future.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5735
+ MaxBECount = getNoopOrZeroExtend(MaxBECount, AddRec->getType());
+ const SCEV *RangeWidth = getNegativeSCEV(getOne(AddRec->getType()));
+ const SCEV *StepAbs = getUMinExpr(Step, getNegativeSCEV(Step));
----------------
You can use the recently added getMinusOne() here.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5764
+ ConstantRange EndRange =
+ IsSigned ? getSignedRange(End) : getUnsignedRange(End);
+ ConstantRange RangeBetween = StartRange.unionWith(EndRange);
----------------
It might make more sense to use `getRangeRef(Start, SignHint)` and `getRangeRef(End, SignHint)` here, rather than going SignHint -> IsSigned -> SignHint.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5773
+ IsSigned ? RangeBetween.getLower().sge(RangeBetween.getUpper())
+ : RangeBetween.getLower().uge(RangeBetween.getUpper());
+ if (IsWrappingRange)
----------------
You can use isWrappedSet() and isSignWrappedSet() here (there are some special cases due to the half-open range).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89381/new/
https://reviews.llvm.org/D89381
More information about the llvm-commits
mailing list