diff options
author | Mingming Liu <mingmingl@google.com> | 2024-05-19 22:42:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-19 22:42:18 -0700 |
commit | 6b0733e3a35350679ea9c6056ecd28652d99017f (patch) | |
tree | 9650b31f614af77ca039947c34793ea6e78a832a /llvm/lib/LTO/LTO.cpp | |
parent | b6e102e08cd35543175459494211a3a15f793302 (diff) | |
download | llvm-6b0733e3a35350679ea9c6056ecd28652d99017f.zip llvm-6b0733e3a35350679ea9c6056ecd28652d99017f.tar.gz llvm-6b0733e3a35350679ea9c6056ecd28652d99017f.tar.bz2 |
Revert "[ThinLTO] Populate declaration import status except for distributed ThinLTO under a default-off new option" (#92715)
Reverts llvm/llvm-project#88024
Build bot failures
(https://lab.llvm.org/buildbot/#/builders/259/builds/4727 and
https://lab.llvm.org/buildbot/#/builders/9/builds/43876)
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index e2754d7..5c603ac 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -121,9 +121,6 @@ void llvm::computeLTOCacheKey( support::endian::write64le(Data, I); Hasher.update(Data); }; - auto AddUint8 = [&](const uint8_t I) { - Hasher.update(ArrayRef<uint8_t>((const uint8_t *)&I, 1)); - }; AddString(Conf.CPU); // FIXME: Hash more of Options. For now all clients initialize Options from // command-line flags (which is unsupported in production), but may set @@ -159,18 +156,18 @@ void llvm::computeLTOCacheKey( auto ModHash = Index.getModuleHash(ModuleID); Hasher.update(ArrayRef<uint8_t>((uint8_t *)&ModHash[0], sizeof(ModHash))); - std::vector<std::pair<uint64_t, uint8_t>> ExportsGUID; + std::vector<uint64_t> ExportsGUID; ExportsGUID.reserve(ExportList.size()); - for (const auto &[VI, ExportType] : ExportList) - ExportsGUID.push_back( - std::make_pair(VI.getGUID(), static_cast<uint8_t>(ExportType))); + for (const auto &VI : ExportList) { + auto GUID = VI.getGUID(); + ExportsGUID.push_back(GUID); + } // Sort the export list elements GUIDs. llvm::sort(ExportsGUID); - for (auto [GUID, ExportType] : ExportsGUID) { + for (uint64_t GUID : ExportsGUID) { // The export list can impact the internalization, be conservative here Hasher.update(ArrayRef<uint8_t>((uint8_t *)&GUID, sizeof(GUID))); - AddUint8(ExportType); } // Include the hash for every module we import functions from. The set of @@ -202,7 +199,7 @@ void llvm::computeLTOCacheKey( [](const ImportModule &Lhs, const ImportModule &Rhs) -> bool { return Lhs.getHash() < Rhs.getHash(); }); - std::vector<std::pair<uint64_t, uint8_t>> ImportedGUIDs; + std::vector<uint64_t> ImportedGUIDs; for (const ImportModule &Entry : ImportModulesVector) { auto ModHash = Entry.getHash(); Hasher.update(ArrayRef<uint8_t>((uint8_t *)&ModHash[0], sizeof(ModHash))); @@ -210,13 +207,11 @@ void llvm::computeLTOCacheKey( AddUint64(Entry.getFunctions().size()); ImportedGUIDs.clear(); - for (auto &[Fn, ImportType] : Entry.getFunctions()) - ImportedGUIDs.push_back(std::make_pair(Fn, ImportType)); + for (auto &Fn : Entry.getFunctions()) + ImportedGUIDs.push_back(Fn); llvm::sort(ImportedGUIDs); - for (auto &[GUID, Type] : ImportedGUIDs) { + for (auto &GUID : ImportedGUIDs) AddUint64(GUID); - AddUint8(Type); - } } // Include the hash for the resolved ODR. @@ -286,9 +281,9 @@ void llvm::computeLTOCacheKey( // Imported functions may introduce new uses of type identifier resolutions, // so we need to collect their used resolutions as well. for (const ImportModule &ImpM : ImportModulesVector) - for (auto &[GUID, UnusedImportType] : ImpM.getFunctions()) { + for (auto &ImpF : ImpM.getFunctions()) { GlobalValueSummary *S = - Index.findSummaryInModule(GUID, ImpM.getIdentifier()); + Index.findSummaryInModule(ImpF, ImpM.getIdentifier()); AddUsedThings(S); // If this is an alias, we also care about any types/etc. that the aliasee // may reference. @@ -1400,7 +1395,6 @@ public: llvm::StringRef ModulePath, const std::string &NewModulePath) { std::map<std::string, GVSummaryMapTy> ModuleToSummariesForIndex; - std::error_code EC; gatherImportedSummariesForModule(ModulePath, ModuleToDefinedGVSummaries, ImportList, ModuleToSummariesForIndex); @@ -1409,8 +1403,6 @@ public: sys::fs::OpenFlags::OF_None); if (EC) return errorCodeToError(EC); - - // TODO: Serialize declaration bits to bitcode. writeIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex); if (ShouldEmitImportsFiles) { |