[PATCH] D23917: Improve documentation and testing for isl_valFromAPInt

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 04:52:17 PDT 2016


Meinersbur accepted this revision.
Meinersbur added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/Support/GICHelper.cpp:45
@@ -33,3 +44,3 @@
   if (IsSigned)
-    Abs = Int.abs();
+    Abs = Int.sext(Int.getBitWidth() + 1).abs();
   else
----------------
Is this a bug discovered by the additional tests?

================
Comment at: unittests/Isl/IslTest.cpp:117
@@ -68,3 +116,3 @@
     // Compare with the two's complement of -1 in a 1-bit integer.
     EXPECT_EQ(APNOne, 1);
     EXPECT_EQ(APNOne.getBitWidth(), 1u);
----------------
I reversed the arguments of `EXPECT_EQ` in APIntToIslVal because how a fail is printed:
```
C:\Users\Meinersbur\src\llvm\tools\polly\unittests\Isl\IslTest.cpp(71): error: Value of: 1
Expected: APNOne
Which is: 16-byte object <02-00 00-00 F6-7F 00-00 02-00 00-00 00-00 00-00>
```
should we reverse all of them (for consistency),such that the output would be:
```
C:\Users\Meinersbur\src\llvm\tools\polly\unittests\Isl\IslTest.cpp(71): error: Value of: APNOne
  Actual: 16-byte object <02-00 00-00 F6-7F 00-00 02-00 00-00 00-00 00-00>
Expected: 1
```


https://reviews.llvm.org/D23917





More information about the llvm-commits mailing list