[PATCH] D28005: Add a unit field to DIGlobalVariable, mirroring the design of DISubprogram.
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 16:46:34 PST 2016
> On Dec 20, 2016, at 4:39 PM, Adrian Prantl <aprantl at apple.com> wrote:
>
>
>> On Dec 20, 2016, at 4:31 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>>> On Dec 20, 2016, at 4:30 PM, Adrian Prantl <aprantl at apple.com> wrote:
>>>> On Dec 20, 2016, at 4:24 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>>>
>>>> Based on the discussion about DISubprogram deduplication for inline functions in (all flavors of) LTO - could we make this unit link null for non-external (well, specifically globals that can be duplicated - linkonce_odr and the like) & just emit those into whichever CU references them first?
>>>> This would avoid redundant descriptions (where all but one lacks any location description, etc) of deduplicable globals. Though perhaps it's a non-issue for globals, since they aren't inlined - but they could be reduced to a constant which is sort of the same.
>>>>
>>>> I can explain/provide examples if I'm being vague/hand-wavy.
>>>
>>> How do I generate linkonce_odr global variable with clang? I would like to experiment with this a bit before I can answer your question.
>>
>> Any template instantiation.
>
> Can you give me an example? I understand how to generate a linkonce_odr *function*, but it's not obvious to me how to do generate a global variable.
Sure:
// test.cpp
template<typename T>
T value = T();
int p = value<int>;
$ clang -std=c++14 -emit-llvm -S -o - test.cpp | grep linkonce_odr
@_Z5valueIiE = linkonce_odr global i32 0, align 4
—
Mehdi
More information about the llvm-commits
mailing list