[PATCH] D67339: [ConstantRange] add helper function addWithNoWrap
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 02:46:17 PDT 2019
nikic accepted this revision.
nikic added a comment.
LGTM
================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:767
+ }
+ });
+ });
----------------
This should also check for `EXPECT_TRUE(CR.contains(N))`, if both overflow flags are false. Because `N` must be the same for both operations, it might make sense to not have two separate branches, that is:
```
bool IsSignedOverflow, IsUnsignedOverflow;
APInt N = IntFnSigned(IsSignedOverflow, N1, N2);
(void) IntFnUnsigned(IsSignedOverflow, N1, N2);
if (!IsSignedOverflow && !IsUnsignedOverflow) {
// Compute SMin, SMax, UMin, UMax
EXPECT_TRUE(CR.contains(N));
}
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67339/new/
https://reviews.llvm.org/D67339
More information about the llvm-commits
mailing list