[PATCH] D69918: [CR][WIP] Add `subWithNoWrap()` method

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 12:30:00 PST 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: nikic, shchenz, efriedma.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.

Much like D67339 <https://reviews.llvm.org/D67339>, adds ConstantRange handling for
when we know no-wrap behavior of the `sub`.

This is WIP, just barely working enough to post.

As noted in https://reviews.llvm.org/D67339#inline-629306,
there is something wrong with the exhaustive tests,
Those overflow checks in `addWithNoWrap()` aren't needed,
as per test coverage.

Even if i add a check `if every permutation
of ForeachNumInConstantRange()*ForeachNumInConstantRange()` says
there's overflow, then `ConstantRange::*WithNoWrap()` should
have returned Empty set, those overflow checks
are still not needed for `add`. One check is needed for `sub` though.

So, what is the missing check?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69918

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: D69918.228122.patch
Type: text/x-patch
Size: 8128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191106/9296a887/attachment.bin>


More information about the llvm-commits mailing list