r194296 - Use rauw for all discardable aliases, not just linkonce_odr.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Nov 22 10:41:21 PST 2013


LGTM. I would probably just reword the fixme:

+    // FIXME: The combination of AvailableExternally and AlwaysInline
+    // confuses LLVM. Before should be clarified and the condition dropped.

to something like

A function show up as "available_externally always_inline" if there is
an extern template instantiation declaration and the method is marked
always_inline. Since there is an extern template instantiation
declaration, one would expect to be valid to reference such method.
Unfortunately libc++'s expectation is that the always_inline always
prevents a reference, so disable this optimization for now.

We should then see if we can avoid the extern template instantiation
declaration in libc++ and at some point reenable this optimization. I
think the assumption is broken in general, for example

---------------------
template<typename T>
struct foo {
  __attribute__((always_inline))void f() {
  }
};

extern template struct foo<int>;

typedef void (foo<int>::*ptr)();

void h(ptr x);
void g() {
  h(&foo<int>::f);
}
------------------------

has to produce an undefined reference to foo<int>::f().

On 22 November 2013 11:37, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
> On Fri, Nov 22, 2013 at 08:23:09AM -0500, Rafael EspĂ­ndola wrote:
>> > How does the attached patch look?
>>
>> Close, but please:
>>
>> * Disallow only the "available_externally always_inline" combination.
>> Your patch would disable it for all always_inline.
>> * Add a comment to the file saying why we don't want to rauw if the
>> target is is available_externally always_inline and maybe a FIXME
>> about the existence of this combination being a bit odd.
>> * clang-format the test :-)
>> * merge the test into test/CodeGenCXX/ctor-dtor-alias.cpp
>
> Updated.
>
> Joerg
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list