[PATCH] D64869: [SCEV] get more accurate range for AddExpr with NW flag

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 07:32:32 PDT 2019


shchenz created this revision.
shchenz added reviewers: nikic, sanjoy, hfinkel, reames.
Herald added subscribers: llvm-commits, wuzish, hiraditya.
Herald added a project: LLVM.

for AddExpr ` (1 + %a)<nsw>`, if `%a` (LoopInvariant, such as function parameter) range is `fullset`, `1` range is `[1, 2)`, for now, constant range add operation will return `fullset` is any of its operand is `fullset`.

For above AddExpr, `(1 + %a)<nsw>` has No-Signed-Wrap flag, so `SINT_MIN` is not in `(1 + %a)<nsw>` range. But now we get a conservative range, `fullset`.

This patch is to improve this issue. This patch is based on patch https://reviews.llvm.org/D64868


https://reviews.llvm.org/D64869

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
  llvm/test/Analysis/ScalarEvolution/trip-count12.ll
  llvm/test/Analysis/ScalarEvolution/trip-count9.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64869.210323.patch
Type: text/x-patch
Size: 4492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190717/834e2d65/attachment.bin>


More information about the llvm-commits mailing list