[llvm-commits] [PATCH] Rotate constant folding bug

Eli Friedman eli.friedman at gmail.com
Thu Oct 13 14:38:36 PDT 2011


On Thu, Oct 13, 2011 at 2:26 PM, Cameron McInally
<cameron.mcinally at nyu.edu> wrote:
> Hi Eli,
> Please find the updated patch and simple unit test attached. I would have
> liked to add a more thorough unit test, but I believe there's a bug in the
> unit tests also. Could you please confirm the following...
> Looking at TEST(APIntTest, i1) in unittests/ADT/APIntTest.cpp, I see an
> APInt defined as:
>> const APInt two(1, 2);
> If I'm not mistaken, that's one bit representing the unsigned value '2'. So,
> effectively, that APInt is a '0'. Unless this was done deliberately (which
> is why I'm asking), I believe the unit tests following this definition are
> not doing what they are supposed to do.
> If you can confirm, I can take a whack at straightening things out.

Digging through SVN history, it looks like it was deliberate.  That
said, I agree they aren't very useful beyond having a test to check
that the truncation works correctly.

For your patch, it would be nice to have tests for rotates of APInt
wider than 1 bit. :)

-Eli



More information about the llvm-commits mailing list