[ThinLTO] Thin link efficiency: More efficient export list computation
authorTeresa Johnson <tejohnson@google.com>
Fri, 16 Dec 2016 04:11:51 +0000 (04:11 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 16 Dec 2016 04:11:51 +0000 (04:11 +0000)
commitedddca22c9f0c6ed44e9be65dda7cca07b598b09
treeba6a5625cf2121829375b67f0def321dc9585d8f
parentba5de63bc32bdfa3bdf3d99f8fa49a3b38717017
[ThinLTO] Thin link efficiency: More efficient export list computation

Summary:
Instead of checking whether a global referenced by a function being
imported is defined in the same module, speculatively always add the
referenced globals to the module's export list. After all imports are
computed, for each module prune any not in its defined set from its
export list.

For a huge C++ app with aggressive importing thresholds, even with
D27687 we spent a lot of time invoking modulePath() from
exportGlobalInModule (modulePath() was still the 2nd hottest routine in
profile). The reason is that with comdat/linkonce the summary lists for
each GUID can be long. For the app in question, for example, we were
invoking exportGlobalInModule almost 2 million times, and we traversed
an average of 63 entries in the summary list each time.

This patch reduced the thin link time for the app by about 10% (on top
of D27687) when using aggressive importing thresholds, and about 3.5% on
average with default importing thresholds.

Reviewers: mehdi_amini

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27755

llvm-svn: 289918
llvm/lib/Transforms/IPO/FunctionImport.cpp