[PATCH] D67339: [ConstantRange] add helper function addWithNoWrap
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 02:43:41 PDT 2019
shchenz marked 3 inline comments as done.
shchenz added a comment.
Hi @nikic, thanks for your comments. Could you help to have another look?
================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:701
+ RangeAlwaysOverflowLow &= false;
+ }
+ });
----------------
nikic wrote:
> The logic here seems unnecessary complicated to me. Couldn't we do something like this?
>
> ```
> bool IsOverflow = false;
> APInt N = IntFn(IsOverflow, N1, N2);
> if (!IsOverflow) {
> if (N.sle(Min))
> Min = N;
> if (N.sge(Max))
> Max = N;
> }
> ```
>
> here, and use just `sadd_ov()` (without `sadd_sat`) in IntFn? The empty set case can be checked as `if (Min.sgt(Max)) EXPECT_TRUE(CR.isEmptySet());` I believe.
Good idea.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67339/new/
https://reviews.llvm.org/D67339
More information about the llvm-commits
mailing list