[PATCH] Fix for nasty LTO issue that's most obvious in ObjectiveC.

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Nov 5 16:42:57 PST 2014


> On 2014-Nov-05, at 15:52, Kevin Frei <freik at fb.com> wrote:
> 
> Hi abdulras,
> 
> The LTO module linker is dropping the 'isExternallyInitialized' attribute from GlobalVariable's as it's copying them into the One Module to Rule Them All. This results in later phases believing that values can be copy-prop'ed or pre-evaluated. The second change is the one that actually fixes the problem, but the first change looks like a similar oversight, so I also changed it to include the attribute.
> 
> This bug prevents LTO from being usable by the Facebook iOS app.

Thanks for working on this!

The fix looks basically good to me, but the test isn't well targeted.

Rafael's minimal example in PR21490 [1] is a better starting point:

    $ cat test.ll
    @foo = private externally_initialized global i8* null
    $ llvm-link -S test.ll -o -
    ; ModuleID = 'llvm-link'
    
    @foo = private global i8* null

You just need to add RUN/CHECK lines based on `llvm-link`; no need
to create an object and inspect it.

Also, please add a similar test (same file is fine) for appending
linkage.

[1]: http://llvm.org/bugs/show_bug.cgi?id=21490



More information about the llvm-commits mailing list