diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2019-11-14 16:07:13 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2019-11-14 16:07:13 +0100 |
commit | 360f661733245ec15be4fc10c413f683c3cdd13f (patch) | |
tree | cb996f56a1c5407b37e712730734db7884490c6a /llvm/lib/LTO | |
parent | a0a38b81ea911f1cd4e400f1ab54dd4930598a7c (diff) | |
download | bcm5719-llvm-360f661733245ec15be4fc10c413f683c3cdd13f.tar.gz bcm5719-llvm-360f661733245ec15be4fc10c413f683c3cdd13f.zip |
Revert "[ThinLTO] Add correctness check for RO/WO variable import"
This reverts commit a2292cc537b561416c21e8d4017715d652c144cc. Breaks
clang selfhost w/ThinLTO.
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 27 | ||||
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 7 |
2 files changed, 17 insertions, 17 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 9c59ec40274..1e345e7dd89 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -146,11 +146,9 @@ void llvm::computeLTOCacheKey( // Include the hash for the current module auto ModHash = Index.getModuleHash(ModuleID); Hasher.update(ArrayRef<uint8_t>((uint8_t *)&ModHash[0], sizeof(ModHash))); - for (const auto &VI : ExportList) { - auto GUID = VI.getGUID(); + for (auto F : ExportList) // The export list can impact the internalization, be conservative here - Hasher.update(ArrayRef<uint8_t>((uint8_t *)&GUID, sizeof(GUID))); - } + Hasher.update(ArrayRef<uint8_t>((uint8_t *)&F, sizeof(F))); // Include the hash for every module we import functions from. The set of // imported symbols for each module may affect code generation and is @@ -385,12 +383,12 @@ static bool isWeakObjectWithRWAccess(GlobalValueSummary *GVS) { } static void thinLTOInternalizeAndPromoteGUID( - GlobalValueSummaryList &GVSummaryList, ValueInfo VI, - function_ref<bool(StringRef, ValueInfo)> isExported, + GlobalValueSummaryList &GVSummaryList, GlobalValue::GUID GUID, + function_ref<bool(StringRef, GlobalValue::GUID)> isExported, function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)> isPrevailing) { for (auto &S : GVSummaryList) { - if (isExported(S->modulePath(), VI)) { + if (isExported(S->modulePath(), GUID)) { if (GlobalValue::isLocalLinkage(S->linkage())) S->setLinkage(GlobalValue::ExternalLinkage); } else if (EnableLTOInternalization && @@ -398,7 +396,7 @@ static void thinLTOInternalizeAndPromoteGUID( // doesn't resolve them. !GlobalValue::isLocalLinkage(S->linkage()) && (!GlobalValue::isInterposableLinkage(S->linkage()) || - isPrevailing(VI.getGUID(), S.get())) && + isPrevailing(GUID, S.get())) && S->linkage() != GlobalValue::AppendingLinkage && // We can't internalize available_externally globals because this // can break function pointer equality. @@ -417,12 +415,12 @@ static void thinLTOInternalizeAndPromoteGUID( // as external and non-exported values as internal. void llvm::thinLTOInternalizeAndPromoteInIndex( ModuleSummaryIndex &Index, - function_ref<bool(StringRef, ValueInfo)> isExported, + function_ref<bool(StringRef, GlobalValue::GUID)> isExported, function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)> isPrevailing) { for (auto &I : Index) - thinLTOInternalizeAndPromoteGUID( - I.second.SummaryList, Index.getValueInfo(I), isExported, isPrevailing); + thinLTOInternalizeAndPromoteGUID(I.second.SummaryList, I.first, isExported, + isPrevailing); } // Requires a destructor for std::vector<InputModule>. @@ -1332,10 +1330,11 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache, ExportedGUIDs.insert( GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Def))); - auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) { + auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) { const auto &ExportList = ExportLists.find(ModuleIdentifier); - return (ExportList != ExportLists.end() && ExportList->second.count(VI)) || - ExportedGUIDs.count(VI.getGUID()); + return (ExportList != ExportLists.end() && + ExportList->second.count(GUID)) || + ExportedGUIDs.count(GUID); }; // Update local devirtualized targets that were exported by cross-module diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 02dda2ab7ac..300203bcc1c 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -589,10 +589,11 @@ struct IsExported { const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) : ExportLists(ExportLists), GUIDPreservedSymbols(GUIDPreservedSymbols) {} - bool operator()(StringRef ModuleIdentifier, ValueInfo VI) const { + bool operator()(StringRef ModuleIdentifier, GlobalValue::GUID GUID) const { const auto &ExportList = ExportLists.find(ModuleIdentifier); - return (ExportList != ExportLists.end() && ExportList->second.count(VI)) || - GUIDPreservedSymbols.count(VI.getGUID()); + return (ExportList != ExportLists.end() && + ExportList->second.count(GUID)) || + GUIDPreservedSymbols.count(GUID); } }; |