[llvm-commits] [PATCH] Compress Repeated Byte Output

David A. Greene greened at obbligato.org
Wed Aug 31 10:45:39 PDT 2011


Chris Lattner <clattner at apple.com> writes:

>> 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.

How so?  You can't, for example, expect the usual properties of algebra
to hold.  That disallows all kinds of distributions, reassociations,
etc. which in turn can negatively affect the ability to, for example,
determine loop dependence information.

Yes, these are corner cases but they do crop up -- surprisingly often.

> > Is there a specific reason to prefer unsigned?
>
> The value is unsigned, it conveys intentions more clearly.

Conveys to whom or what?  It restricts the compiler.  If you're ok with
that, that's fine but it is something to be aware of.

> This is quite consistent in the codebase.

Yes, I know.  I'm wary of absolute rules like this that work for many
cases but cause real (performance) issues in other cases.

                            -Dave



More information about the llvm-commits mailing list