[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 01:00:54 PST 2020


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5675
       bool AllNonPos = true;
       for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) {
         if (!isKnownNonNegative(AddRec->getOperand(i))) AllNonNeg = false;
----------------
With the new code, we can skip operand zero (start) here. We only need that the step operands have a known sign so the addrec moves in a known direction, but the sign of the start value doesn't matter.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72436/new/

https://reviews.llvm.org/D72436





More information about the llvm-commits mailing list