[llvm-commits] [PATCH] Compress Repeated Byte Output
Chris Lattner
clattner at apple.com
Wed Aug 31 09:47:24 PDT 2011
On Aug 31, 2011, at 9:19 AM, David A. Greene wrote:
> Chris Lattner <clattner at apple.com> writes:
>
>> + for (int i = 1, e = CA->getNumOperands(); i != e; ++i) {
>>
>> Please declare 'i' as 'unsigned' instead of 'int'.
>
> I'm not objecting to this, but rather am curious.
>
> Typing loop counters as unsigned can do all sorts of horrible things to
> analysis and optimization due to wraparound requirements.
This isn't the case for loops that start at a constant and stride by 1.
> I've got into
> the habit of always typing loop counters as signed to avoid these
> issues. Is there a specific reason to prefer unsigned?
The value is unsigned, it conveys intentions more clearly. This is quite consistent in the codebase.
-Chris
More information about the llvm-commits
mailing list