[ThinLTO] Enable importing of aliases as copy of aliasee
authorTeresa Johnson <tejohnson@google.com>
Sat, 16 Dec 2017 00:18:12 +0000 (00:18 +0000)
committerTeresa Johnson <tejohnson@google.com>
Sat, 16 Dec 2017 00:18:12 +0000 (00:18 +0000)
commit81bbf74265ad9e37eb3330ff355bece0917a804c
tree4c10790c06496c8451c95393f76ac75daf6aa30e
parentc4fdbca604d6ad7a17687ea253d16aa6c0c0e40d
[ThinLTO] Enable importing of aliases as copy of aliasee

Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.

Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).

This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 320895
14 files changed:
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/IR/Value.h
llvm/include/llvm/Transforms/IPO/FunctionImport.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/IR/Value.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/ThinLTO/X86/Inputs/distributed_import.ll
llvm/test/ThinLTO/X86/Inputs/distributed_indexes.ll
llvm/test/ThinLTO/X86/alias_import.ll
llvm/test/ThinLTO/X86/distributed_import.ll
llvm/test/ThinLTO/X86/distributed_indexes.ll
llvm/test/ThinLTO/X86/funcimport.ll
llvm/test/Transforms/FunctionImport/funcimport.ll