diff options
| author | Steven Wu <stevenwu@apple.com> | 2018-11-13 17:35:04 +0000 |
|---|---|---|
| committer | Steven Wu <stevenwu@apple.com> | 2018-11-13 17:35:04 +0000 |
| commit | fa43892d6fdf77e373dcf54f1c934380b8731df2 (patch) | |
| tree | 4908fa417e03b50a4713544230c993893fd38afb /llvm/lib/Transforms/Utils/FunctionImportUtils.cpp | |
| parent | 77c17e26eaca06626a4ad1d9b2ccaba28d15b62f (diff) | |
Revert "[ThinLTO] Internalize readonly globals"
This reverts commit 10c84a8f35cae4a9fc421648d9608fccda3925f2.
llvm-svn: 346768
Diffstat (limited to 'llvm/lib/Transforms/Utils/FunctionImportUtils.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/FunctionImportUtils.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp index 89e74da4d99c..479816a339d0 100644 --- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp +++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp @@ -204,9 +204,8 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) { // Check the summaries to see if the symbol gets resolved to a known local // definition. - ValueInfo VI; if (GV.hasName()) { - VI = ImportIndex.getValueInfo(GV.getGUID()); + ValueInfo VI = ImportIndex.getValueInfo(GV.getGUID()); if (VI && VI.isDSOLocal()) { GV.setDSOLocal(true); if (GV.hasDLLImportStorageClass()) @@ -214,22 +213,6 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) { } } - // Mark read-only variables which can be imported with specific attribute. - // We can't internalize them now because IRMover will fail to link variable - // definitions to their external declarations during ThinLTO import. We'll - // internalize read-only variables later, after import is finished. - // See internalizeImmutableGVs. - // - // If global value dead stripping is not enabled in summary then - // propagateConstants hasn't been run (may be because we're using - // distriuted import. We can't internalize GV in such case. - if (!GV.isDeclaration() && VI && ImportIndex.withGlobalValueDeadStripping()) { - const auto &SL = VI.getSummaryList(); - auto *GVS = SL.empty() ? nullptr : dyn_cast<GlobalVarSummary>(SL[0].get()); - if (GVS && GVS->isReadOnly()) - cast<GlobalVariable>(&GV)->addAttribute("thinlto-internalize"); - } - bool DoPromote = false; if (GV.hasLocalLinkage() && ((DoPromote = shouldPromoteLocalToGlobal(&GV)) || isPerformingImport())) { @@ -247,7 +230,7 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) { // Remove functions imported as available externally defs from comdats, // as this is a declaration for the linker, and will be dropped eventually. // It is illegal for comdats to contain declarations. - auto *GO = dyn_cast<GlobalObject>(&GV); + auto *GO = dyn_cast_or_null<GlobalObject>(&GV); if (GO && GO->isDeclarationForLinker() && GO->hasComdat()) { // The IRMover should not have placed any imported declarations in // a comdat, so the only declaration that should be in a comdat |
