aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2023-07-31 11:32:11 -0700
committerTeresa Johnson <tejohnson@google.com>2023-09-01 13:43:08 -0700
commitbbe8cd13335300958b04db5318c31ff52714f96f (patch)
tree52d3291f070d9f991fd61a73645978be27cef97e /llvm/lib/LTO/LTO.cpp
parentb0b3f82dd3c00cdba891f1ff6ba63abd419d0f18 (diff)
downloadllvm-bbe8cd13335300958b04db5318c31ff52714f96f.zip
llvm-bbe8cd13335300958b04db5318c31ff52714f96f.tar.gz
llvm-bbe8cd13335300958b04db5318c31ff52714f96f.tar.bz2
[LTO] Remove module id from summary index
The module paths string table mapped to both an id sequentially assigned during LTO linking, and the module hash. The former is leftover from before the module hash was added for caching and subsequently replaced use of the module id when renaming promoted symbols (to avoid affects due to link order changes). The sequentially assigned module id was not removed, however, as it was still a convenience when serializing to/from bitcode and assembly. This patch removes the module id from this table, since it isn't strictly needed and can lead to confusion on when it is appropriate to use (e.g. see fix in D156525). It also takes a (likely not significant) amount of overhead. Where an integer module id is needed (e.g. bitcode writing), one is assigned on the fly. There are a couple of test changes since the paths are now sorted alphanumerically when assigning ids on the fly during assembly writing, in order to ensure deterministic behavior. Differential Revision: https://reviews.llvm.org/D156730
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index f851037..2a3f44d 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -183,7 +183,7 @@ void llvm::computeLTOCacheKey(
return ModIt->second;
}
- const ModuleHash &getHash() const { return ModInfo->second.second; }
+ const ModuleHash &getHash() const { return ModInfo->second; }
};
std::vector<ImportModule> ImportModulesVector;
@@ -765,7 +765,7 @@ Error LTO::addModule(InputFile &Input, unsigned ModI,
// Regular LTO module summaries are added to a dummy module that represents
// the combined regular LTO module.
- if (Error Err = BM.readSummary(ThinLTO.CombinedIndex, "", -1ull))
+ if (Error Err = BM.readSummary(ThinLTO.CombinedIndex, ""))
return Err;
RegularLTO.ModsWithSummaries.push_back(std::move(*ModOrErr));
return Error::success();
@@ -1013,16 +1013,14 @@ Error LTO::addThinLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
}
}
- uint64_t ModuleId = ThinLTO.ModuleMap.size();
if (Error Err =
BM.readSummary(ThinLTO.CombinedIndex, BM.getModuleIdentifier(),
- ModuleId, [&](GlobalValue::GUID GUID) {
+ [&](GlobalValue::GUID GUID) {
return ThinLTO.PrevailingModuleForGUID[GUID] ==
BM.getModuleIdentifier();
}))
return Err;
- LLVM_DEBUG(dbgs() << "Module " << ModuleId << ": " << BM.getModuleIdentifier()
- << "\n");
+ LLVM_DEBUG(dbgs() << "Module " << BM.getModuleIdentifier() << "\n");
for (const InputFile::Symbol &Sym : Syms) {
assert(ResI != ResE);