google/souper — pull request #125 by chenyang78 (2014-11-28 11:59:56+00:00)
Title: don't store UntypedInt with 4-bit APInt values

Integer 8 is represent as b1000 in a 4-bit APInt manner.
Later, when we translate this APInt value into a const using
APInt.sextOrTrunc, we get b11111000 back, which is not what
we want. The bad intepretation only occurs when
we infer the type of an integer, i.e., an integer without :iN.
Note that b11111000 is unsigned char 248, which is why we see
instruction "%8:i1 = eq 248:i8, %0" in John's example.

The fix is to use multiple of 8. It should always be safe.
Also, we won't increase too much memory usage because
it's only for parsing replacements, which are small.