[llvm-commits] [llvm] r95266 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/objsize.ll

Eric Christopher echristo at apple.com
Thu Feb 4 07:55:53 PST 2010


On Feb 4, 2010, at 1:35 AM, Duncan Sands wrote:

> Hi Eric,
> 
>> If we're dealing with a zero-length array, don't lower to any
>> particular size, we just don't know what the length is yet.
> 
> ...
> 
>> + at window = external global [0 x i8]
> 
> I think this is wrong - the problem isn't due to a zero length array, it's
> due to the global being a declaration rather than a definition (i.e. not having
> an initializer).  The type of a declaration doesn't tell you anything about the
> size of the actual object (which is defined in some other object file).   For
> example, suppose this was:
> 
>  @window = external global i32
> 
> and then in some other file you have the definition:
> 
>  @window = global i8 0
> 
> This is perfectly legal, and shows that trying to determine the "object size"
> based only on a declaration is hopeless.

Yep. See next patch (that unfortunately I've reverted at the moment.

-eric



More information about the llvm-commits mailing list