[PATCH] D14623: [ThinLTO] Comdat importing fixes and related cleanup
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 12:50:38 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
Thinking some more about this:
>
> @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
Not exactly, f2 can't be imported as-is since that would result in
multiply-defined f2. To avoid that, f2() is imported as
available_externally. Unfortunately, with the change you made in
r254170 we cannot import f() as an alias of the imported f2. It needs
to be a declaration. That may be an issue if f and f2 are part of a
comdat, where we decided to select and therefore import the source
comdat group - it will be incomplete.
>
> if you want just foo, you get
>
> define void @foo() {
> call void @f()
> ret void
> |
> declare void @f()
This is what happens currently (with or without this patch), assuming
f() is not in a comdat group.
>
> 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
> }
Seems like I might need to do this conversion of f2 to internal
(instead of importing as available_externally) when it has an alias
and is part of a comdat group, to avoid an incomplete comdat group as
noted above?
Teresa
>
> 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