[PATCH] D14623: [ThinLTO] Comdat importing fixes and related cleanup

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 11:35:08 PST 2015


On Mon, Nov 30, 2015 at 11:29 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>> Do you mean if the imported function (say 'foo') references an alias ('f'),
>> the aliasee 'f2' will have to be imported and converted to internal linkage?
>
> Depends on what you want to import. My understanding is that your testcase is
>
> @f = alias void (), void ()* @f2
> define void @foo() {
>   call void @f()
>   ret void
> }
> define void @f2() {
>   ret void
> }
>
> if you want foo, f, f2, the output is like the input
>
> if you want just foo, you get
>
> define void @foo() {
>   call void @f()
>   ret void
> |
> declare void @f()

The above is what we will end up with either the existing module
linker code (which converts the alias f() to a decl immediately when
the prototypes are linked) and with this patch (which converts the
alias to a decl after lazy linking is complete). I moved the import of
f() to a later conversion to decl since with the patch we may decide
to lazy link additional comdat groups and don't know whether the
aliasee f2() is imported here until after lazy linking is complete.
Even with your recent change to not allow importing aliases to
available_externally functions, if the aliasee were linkonce we could
import it and leave f() as an alias to the imported f2().


>
> if you want just foo and f, you get
>
> @f = alias void(), void()* @f2
> define void @foo() {
>   call void @f()
>   ret void
> }
> define internal void @f2() {
>   ret void
> }
>
> take a look at pr19848 for another example.
>
> Cheers,
> Rafael



-- 
Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413


More information about the llvm-commits mailing list