[polly] r279734 - Introduce unittests.
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 25 11:26:23 PDT 2016
Hi Michael,
I just looked into this FIXME below myself, and it seems the code might
actually be correct, as we always generate the smallest APInt that is
large enough to model a certain value. For -1, this APInt has a size of
1 bit. If interpreted as signed,
it can contain the values 0 and -1, with 0 modeled as '0' and -1 modeled
as '1' in two's complement representation. If interpreted as unsigned,
these values map to '0' and '1'. Hence, the test below seems to be
correct to me:
> + {
> + auto *IslNOne = isl_val_int_from_si(IslCtx, -1);
> + auto APNOne = APIntFromVal(IslNOne);
> + // APInt has no sign bit, so never equals to a negative number.
> + // FIXME: The canonical representation of a negative APInt is two's
> + // complement.
> + EXPECT_EQ(APNOne, 1);
> + }
It seems we just missed that APInt is of size one bit. What are your
thoughts?
Best,
Tobias
More information about the llvm-commits
mailing list