[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
Thu Dec 19 13:03:11 PST 2019


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5571
+    for (unsigned i = 1, e = Add->getNumOperands(); i != e; ++i) {
+      if (Add->hasNoSignedWrap() &&
+          SignHint == ScalarEvolution::HINT_RANGE_SIGNED)
----------------
reames wrote:
> I'd very strongly prefer if you structured this as so:
> NoWrapKind = compute(Add);
> for each operand:
>   sum += sum.addWithWrapping(Op, NoWrapKind)
> 
> This requires that NoWrapKind above be any of: none, signed, unsigned, and both.
I'd suggest to also pass the `RangeType` here, though I'm not sure whether it makes any practical difference.


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

https://reviews.llvm.org/D64869





More information about the llvm-commits mailing list