[llvm] r208934 - Implement global merge optimization for global variables.

Jiangning Liu liujiangning1 at gmail.com
Thu Jun 5 00:26:56 PDT 2014


Hi Rafael,

I think now I understand your point and agree with you this alignment setup
can be treated as a pure back-end issue AArch64 can handle it privately and
we can avoid exposing it to shared code.

So now attached is the updated patch by removing -global-merge-aligned
switch. I will work out separate patches to handle AArch64 specific stuff
later on.

Thanks,
-Jiangning



2014-06-03 22:16 GMT+08:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:

> > (1) We probably should change the global merge algorithm by considering
> the
> > global symbols function by function, which could finally benefit linker
> to
> > remove dead global symbols. I think I agree with that, but I want to
> leave
> > it for further improvement in future, so I added a FIXME in my new patch
> to
> > explain the issue.
>
> OK.
>
> > (2) We should avoid adding target dependent interfaces in middle-end, so
> it
> > would be better we don't add getGlobalMergeAlignment. I consider it
> again,
> > and think we still need this, and it is orthogonal with (1). For
> AArch64, we
> > need this because we want to make sure the merged global variable doesn't
> > cross page boundary, and this could finally remove one more "addition"
> > instruction finally.
>
> But there is nothing special about a merge variable, right?  Consider
> two cases. In the first, the source code has a user defined type and
> global:
>
> struct foo {
>   int a;
>    int b;
> } my_global;
>
> int the second case the globals are just "int a;" and "int b;". In the
> second case we decide to concatenate 'a' and 'b'. Any alignment
> advantage that can be had in the second case also applies to the
> first, so it seems this should just be an independent optimization in
> the aarch64 backend.
>
> A related issue is that we probably don't want to have codegen options
> like global-merge-aligned.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140605/430021aa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Global-merge-for-global-symbols.patch
Type: text/x-patch
Size: 23852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140605/430021aa/attachment.bin>


More information about the llvm-commits mailing list