[PATCH] D23917: Improve documentation and testing for isl_valFromAPInt

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 04:29:53 PDT 2016


grosser created this revision.
grosser added a reviewer: Meinersbur.
grosser added subscribers: llvm-commits, pollydev.

The recent unit tests we gained made clear that the semantics of
isl_valFromAPInt are not clear, due to missing documentation. In this change we
document both the calling interface as well as the implementation of
isl_valFromAPInt. We also make the implementation easier to read by removing
integer wrappig in abs() when passing in the minimal integer value for a given
bitwidth. Even though wrapping and subsequently interpreting the result as
unsigned value gives the correct result, this is far from obvious.  Instead, we
explicitly add one more bit to the input type to ensure that abs will never
wrap. Finally, we add a test case for this special case and also test a number
larger than 64 bit.

https://reviews.llvm.org/D23917

Files:
  include/polly/Support/GICHelper.h
  lib/Support/GICHelper.cpp
  unittests/Isl/IslTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23917.69341.patch
Type: text/x-patch
Size: 4419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160826/aa7e41ef/attachment.bin>


More information about the llvm-commits mailing list