aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2017-03-10 22:25:39 +0000
committerTobias Grosser <tobias@grosser.es>2017-03-10 22:25:39 +0000
commit9cc7e3561d834c7addda74760d82b9b6fb0ea93e (patch)
tree143bcea0e574de5ab46e5f25381d53c25c101d5d
parentbfe263352a442e6ac3196c6051b9fc332b7af0fb (diff)
downloadllvm-9cc7e3561d834c7addda74760d82b9b6fb0ea93e.zip
llvm-9cc7e3561d834c7addda74760d82b9b6fb0ea93e.tar.gz
llvm-9cc7e3561d834c7addda74760d82b9b6fb0ea93e.tar.bz2
[unittest] Do not convert large unsigned long to isl::val
Currently the isl::val constructor only takes a signed long as parameter, which on Windows is only 32 bit large and can consequently not be used to obtain the same result when loading from the expression '(1ull << 32) - 1)' that we get when loading this value via isl_val_int_from_ui or when loading the value on Linux systems with 64 bit long data types. We avoid this issue by performing the shift and subtractiong within the isl::val. It would be nice to teach the isl++ bindings to construct isl::val from other integer types, but the current interface is not sufficient to do so. If constructors from both signed long and unsigned long are exposed, then integer literals that are of type 'int' and which must be converted to 'long' to match the constructor have two ambigious constructors to choose from, which result in a compiler error. The right solution is likely to additionally expose constructors from signed and unsigned int, but these are not yet available in the isl C interface and adding those adhoc to our bindings is something I would like to avoid for now. We should address this issue with a proper discussion on the isl side. llvm-svn: 297522
-rw-r--r--polly/unittests/Isl/IslTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/polly/unittests/Isl/IslTest.cpp b/polly/unittests/Isl/IslTest.cpp
index 8bdd948..c8bc0fc 100644
--- a/polly/unittests/Isl/IslTest.cpp
+++ b/polly/unittests/Isl/IslTest.cpp
@@ -140,7 +140,7 @@ TEST(Isl, APIntToIslVal) {
{
APInt APNOne(32, (1ull << 32) - 1, false);
auto IslNOne = valFromAPInt(IslCtx, APNOne, false);
- auto IslRef = isl::val(IslCtx, (1ull << 32) - 1);
+ auto IslRef = isl::val(IslCtx, 32).two_exp().sub_ui(1);
EXPECT_EQ(IslNOne, IslRef);
}
@@ -227,7 +227,7 @@ TEST(Isl, IslValToAPInt) {
}
{
- auto IslNOne = isl::val(IslCtx, (1ull << 32) - 1);
+ auto IslNOne = isl::val(IslCtx, 32).two_exp().sub_ui(1);
auto APNOne = APIntFromVal(IslNOne);
EXPECT_EQ((1ull << 32) - 1, APNOne);
EXPECT_EQ(33u, APNOne.getBitWidth());