[PATCH] D60264: [ConstantRange] Add isNegative() and isNonNegative() methods

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 06:28:42 PDT 2019


nikic created this revision.
nikic added reviewers: lebedev.ri, spatel.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Add isNegative() and isNonNegative() methods to ConstantRange, which determine whether all values in the constant range are negative/non-negative. The naming follows KnownBits, where these methods have the same meaning. Could also use something like isAllNegative() and isAllNonNegative(), if that's more clear.

Motivation is to replace existing KnownBits calls when switching over computeOverflowForSignedAdd() to use ranges only (https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis/ValueTracking.cpp#L4154).


Repository:
  rL LLVM

https://reviews.llvm.org/D60264

Files:
  llvm/include/llvm/IR/ConstantRange.h
  llvm/lib/IR/ConstantRange.cpp
  llvm/unittests/IR/ConstantRangeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60264.193697.patch
Type: text/x-patch
Size: 4353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/6963ad10/attachment.bin>


More information about the llvm-commits mailing list