[ThinLTO] Delay metadata materializtion in function importer
authorTeresa Johnson <tejohnson@google.com>
Fri, 8 Jan 2016 14:17:41 +0000 (14:17 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 8 Jan 2016 14:17:41 +0000 (14:17 +0000)
commit1b3af3b51705cf2c8d7133f16d868734cbce8e30
tree26a9dffefefa5db24d2d06c3909b6bb11a9997b0
parent2a613d664f38429d4ef45d56987612b4d0230eb8
[ThinLTO] Delay metadata materializtion in function importer

The function importer was still materializing metadata when modules were
loaded for function importing. We only want to materialize it when we
are going to invoke the metadata linking postpass. Materializing it
before function importing is not only unnecessary, but also causes
metadata referenced by imported functions to be mapped in early, and
then not connected to the rest of the module level metadata when it is
ultimately linked in.

Augmented the test case to specifically check for the metadata being
properly connected, which it wasn't before this fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257171 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/FunctionImport.cpp
test/Transforms/FunctionImport/funcimport_debug.ll