llvm-project/llvm/lib/Transforms/IPO
Teresa Johnson 93f9996278 [ThinLTO] Import local variables from the same module as caller
Summary:
We can sometimes end up with multiple copies of a local variable that
have the same GUID in the index. This happens when there are local
variables with the same name that are in different source files having the
same name/path at compile time (but compiled into different bitcode objects).

In this case make sure we import the copy in the caller's module.
This enables importing both of the variables having the same GUID
(but which will have different promoted names since the module paths,
and therefore the module hashes, will be distinct).

Importing the wrong copy is particularly problematic for read only
variables, since we must import them as a local copy whenever
referenced. Otherwise we get undefs at link time.

Note that the llvm-lto.cpp and ThinLTOCodeGenerator changes are needed
for testing the distributed index case via clang, which will be sent as
a separate clang-side patch shortly. We were previously not doing the
dead code/read only computation before computing imports when testing
distributed index generation (like it was for testing importing and
other ThinLTO mechanisms alone).

Reviewers: evgeny777

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, dang, llvm-commits

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

llvm-svn: 347886
2018-11-29 17:02:42 +00:00
..
AlwaysInliner.cpp Enrich inline messages 2018-08-05 14:53:08 +00:00
ArgumentPromotion.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
BarrierNoopPass.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BlockExtractor.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
CMakeLists.txt Hot cold splitting pass 2018-09-07 15:03:49 +00:00
CalledValuePropagation.cpp [CVP] Handle instructions with no user. No need to create CVPLattice state. This handles terminator instructions and more. 2018-09-17 15:28:01 +00:00
ConstantMerge.cpp Re-commit "[NFC] More ConstantMerge refactoring" 2018-08-10 22:41:09 +00:00
CrossDSOCFI.cpp Don't call skipModule for CFI lowering passes. 2018-04-12 22:04:11 +00:00
DeadArgumentElimination.cpp [deadargelim] Update dbg.value of 'unused' parameters 2018-09-24 10:01:24 +00:00
ElimAvailExtern.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
ExtractGV.cpp Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
ForceFunctionAttrs.cpp [x86/SLH] Add a real Clang flag and LLVM IR attribute for Speculative 2018-09-04 12:38:00 +00:00
FunctionAttrs.cpp Replace most users of UnknownSize with LocationSize::unknown(); NFC 2018-10-10 21:28:44 +00:00
FunctionImport.cpp [ThinLTO] Import local variables from the same module as caller 2018-11-29 17:02:42 +00:00
GlobalDCE.cpp GlobalDCE: Teach isEmptyFunction() to ignore debug intrinsics. 2018-11-16 17:47:21 +00:00
GlobalOpt.cpp [DebugInfo][GlobalOpt] Fix -debugify for globalopt shrinking globals to booleans. 2018-10-23 16:35:51 +00:00
GlobalSplit.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-10 22:49:55 +00:00
HotColdSplitting.cpp [ProfileSummary] Standardize methods and fix comment 2018-11-19 05:23:16 +00:00
IPConstantPropagation.cpp Remove trailing space 2018-07-30 19:41:25 +00:00
IPO.cpp Hot cold splitting pass 2018-09-07 15:03:49 +00:00
InferFunctionAttrs.cpp [InstCombine] Cleanup libfunc attribute inferring 2018-10-16 21:18:31 +00:00
InlineSimple.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Inliner.cpp [ProfileSummary] Standardize methods and fix comment 2018-11-19 05:23:16 +00:00
Internalize.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopExtractor.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
LowerTypeTests.cpp llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) 2018-09-27 02:13:45 +00:00
MergeFunctions.cpp [MergeFuncs] Generate alias instead of thunk if possible 2018-11-21 19:37:19 +00:00
PartialInlining.cpp [PartialInliner] Make PHIs free in cost computation. 2018-11-27 18:17:27 +00:00
PassManagerBuilder.cpp [LTO] Load sample profile in LTO link step. 2018-11-15 18:06:42 +00:00
PruneEH.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
SCCP.cpp [IPSCCP,PM] Preserve PDT in the new pass manager. 2018-11-11 20:22:45 +00:00
SampleProfile.cpp [ProfileSummary] Standardize methods and fix comment 2018-11-19 05:23:16 +00:00
StripDeadPrototypes.cpp
StripSymbols.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
SyntheticCountsPropagation.cpp [SyntheticCounts] Rewrite the code using only graph traits. 2018-01-25 22:02:29 +00:00
ThinLTOBitcodeWriter.cpp s/std::set/DenseSet/; NFC 2018-08-27 22:10:59 +00:00
WholeProgramDevirt.cpp [WPD] Fix incorrect devirtualization after indirect call promotion 2018-09-27 14:55:32 +00:00