[PATCH] D43077: [ThinLTO] Import external globals
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 09:24:07 PST 2018
evgeny777 created this revision.
evgeny777 added reviewers: tejohnson, mehdi_amini.
Herald added subscribers: eraman, inglorion, aprantl.
This patch imports external global variables references by a function, so that `instcombine` and `globalopt` can do some useful work (constant folding and static constructor evaluation) before `elim-avail-extern` either remove imported declarations or convert them back to externals. To simplify things this version only imports globals which have no outgoing references, so I don't have to care about promotion and importing debug info.
I've tested this on several large in-house projects and got 0.7-0.8% size improvement for each of them. I've also tried building LLVM/clang using this patch and also got some size improvement which is however much less impressive (several KB for some executables, about 56K for all of them in Release configuration). LLVM/clang built with this patch pass all tests successfully.
https://reviews.llvm.org/D43077
Files:
include/llvm/Linker/IRMover.h
lib/Linker/IRMover.cpp
lib/Transforms/IPO/FunctionImport.cpp
test/ThinLTO/X86/Inputs/globals-import-cf-baz.ll
test/ThinLTO/X86/Inputs/globals-import-eval-baz.ll
test/ThinLTO/X86/Inputs/globals-import-eval-foo.ll
test/ThinLTO/X86/globals-import-const-fold.ll
test/ThinLTO/X86/globals-import-eval.ll
test/Transforms/FunctionImport/funcimport.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43077.133431.patch
Type: text/x-patch
Size: 13251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/0dd68199/attachment.bin>
More information about the llvm-commits
mailing list