[llvm-commits] [PATCH] Compress Repeated Byte Output
David A. Greene
dag at cray.com
Mon Aug 29 09:39:31 PDT 2011
Chris Lattner <clattner at apple.com> writes:
> On Aug 26, 2011, at 10:48 AM, David Greene wrote:
>
>>
>> Emit a repeated sequence of bytes using .zero. This saves an enormous
>> amount of asm file space for certain programs.
>> ---
>
> In addition to the return, please remove these two cases, which are handled below with the generic code:
>
> + if (CI->isZero())
> + return 0;
> + if (CI->isAllOnesValue())
> + return 0xfful;
Ok. I was trying to speed up common cases.
>
>
> + uint8_t Byte = Value & 0xffull;
>
> What's up with the ULL suffixes here and UL elsewhere? Please use
> capital suffixes if you want to keep them. I'd recommend just
> replacing this with uint8_t(Value) which is more explicit.
ULL because Value is a 64-bit quantity. But yeah, a cast should work.
> + if (Size == 1)
> + return Byte;
>
> Please remove this, it isn't doing anything.
Ok.
> Your ConstantInt handling code still doesn't handle i11's. You need
> to ensure that we have a multiple of 8 bits and a power of 2 (to avoid
> tail padding being ignored).
Didn't know we have such things. Will fix.
> + return Byte;
> + }
> + else if
>
> No need for the else.
Right.
> + else if (const ConstantArray *CA = dyn_cast<ConstantArray>(V)) {
> + // Make sure all array elements are sequences of the same repeated
> + // byte.
> + int Byte = -1;
> + for (int i = 0, e = CA->getNumOperands(); i != e; ++i) {
>
> This is awkward. Just peel off one iteration:
All right.
-Dave
More information about the llvm-commits
mailing list