[PATCH] D61207: [ConstantRange] Add srem() support

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 12:06:38 PDT 2019


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

Add support for srem() to ConstantRange so we can use it in LVI. For srem the sign of the result matches the sign of the LHS. For the RHS only the absolute value is important. Apart from that the logic is like urem.

Just like for urem this is only an approximate implementation. The tests check a few specific cases and run an exhaustive test for conservative correctness (but not exactness).


Repository:
  rL LLVM

https://reviews.llvm.org/D61207

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: D61207.196895.patch
Type: text/x-patch
Size: 7688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190426/2903fba0/attachment.bin>


More information about the llvm-commits mailing list