[llvm] r189954 - Revert "Add r159136 back now that pr13124 has been fixed."
Rafael EspĂndola
rafael.espindola at gmail.com
Wed Sep 4 13:24:55 PDT 2013
>> Say we have a "linkonce_odr unnamed_addr" in two translation units:
>> * In TU 1 this optimization kicks in and makes it hidden.
>> * In TU 2 it gets const merged with a constant that is *not* unnamed_addr,
>> resulting in a non unnamed_addr constant with default visibility.
>
>
> That shouldn't happen. A hidden symbol doesn't get merged with anything
> outside its TU, right? I think you can just rename it.
hidden, not internal, so it does get merged.
But yes, one way to handle this without LTO is to make the
linkonce_odr symbol internal instead of hidden. This introduces a bit
of code duplication, but can be profitable if the function is really
small.
Wit gcc 4.8 when compiling
------------------------------
void f();
struct foo {
typedef void (foo::*mptr)();
virtual mptr zed();
void bar() {
}
__attribute__((noinline)) void baz() {
f();
}
virtual void bah() {
};
};
foo::mptr foo::zed() {
baz();
return &foo::bar;
}
-------------------------------------
I get an internal _ZN3foo3bazEv.isra.0 function which effective
implements this optimization.
> Nick
>
Cheers,
Rafael
More information about the llvm-commits
mailing list