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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 13:38:02 PST 2019


lebedev.ri updated this revision to Diff 228132.
lebedev.ri added a comment.

In D69918#1736126 <https://reviews.llvm.org/D69918#1736126>, @nikic wrote:

> In D69918#1736118 <https://reviews.llvm.org/D69918#1736118>, @lebedev.ri wrote:
>
> > > If that's the case, I'm not sure whether or not we should rely on that, it seems rather subtle.
> >
> > Now that i've added `EXPECT_EQ(CR.isEmptySet(), AllOverflow);` test,
> >  that seems like a safe assumption to me? Seems like a net win to me.
>
>
> I guess it's okay, please add a comment to the implementation that we're relying on this lucky accident though.




> You might also want to piggy-back on the existing `CR.uadd_sat` and `CR.sadd_sat` implementations, now that the code is essentially the same.

D'oh! So *that's* why all that code looked weird to me. Now this is much better i think :)


Repository:
  rG LLVM Github Monorepo

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

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.228132.patch
Type: text/x-patch
Size: 8428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191106/21a1e3e6/attachment.bin>


More information about the llvm-commits mailing list