]> granicus.if.org Git - llvm/commit
[GlobalMerge] Look at uses to create smaller global sets.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 18 Apr 2015 01:21:58 +0000 (01:21 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 18 Apr 2015 01:21:58 +0000 (01:21 +0000)
commit35e80553937f84d1b562f00fa757ee700d142f99
treeeb2a6bfe37934f479a2459bf68d9c4a669cfd421
parent20b39c653c3db539a728cd67faf7b6026619e4e2
[GlobalMerge] Look at uses to create smaller global sets.

Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".

Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.

In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative.  Anything in-between isn't trivially
available, so stick with Function grouping for now.

cl::opts are added for testing; both enabled by default.

A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur.  Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.

Differential Revision: http://reviews.llvm.org/D8070

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235249 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/GlobalMerge.cpp
test/CodeGen/AArch64/global-merge-group-by-use.ll [new file with mode: 0644]
test/CodeGen/AArch64/global-merge-ignore-single-use.ll [new file with mode: 0644]
test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll
test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
test/CodeGen/ARM/global-merge-addrspace.ll
test/CodeGen/ARM/global-merge.ll