[llvm] r209015 - Add comdat key field to llvm.global_ctors and llvm.global_dtors

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 4 17:46:39 PDT 2014


>> Sure, it can definitely wait for us having comdat support in the IR :-)
>
>
> Actually, I take this statement back.  We can still use the global variable
> as the comdat key.  If the GV has a section with an explicit comdat group,
> we can grab that group and use it for the initializer too.  Otherwise, we
> keep using the implicit group created for linkonce_odr / weak_odr data.

Not sure I follow. Given


struct S {
 static const int x;
};
template<typename T> struct U {
 static const int k;
};
template<typename T> const int U<T>::k = T::x;
int f() { return U<S>::k; }


There are two comdat groups: _ZGVN1UI1SE1kE and _ZN1UI1SE1kE. Which
groups do you thing we should produce instead?

Cheers,
Rafael



More information about the llvm-commits mailing list