mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-27 05:32:22 +00:00
[ThinLTO] Hash more part of the config to build cache entries
This has been fixed in the "new" LTO API used by Gold/LLD, this is fixing the same issue in the libLTO API used by ld64 (amongst other) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291518 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2683e96291
commit
39ed1db310
@ -284,7 +284,8 @@ public:
|
||||
const FunctionImporter::ExportSetTy &ExportList,
|
||||
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,
|
||||
const GVSummaryMapTy &DefinedFunctions,
|
||||
const DenseSet<GlobalValue::GUID> &PreservedSymbols) {
|
||||
const DenseSet<GlobalValue::GUID> &PreservedSymbols, unsigned OptLevel,
|
||||
const TargetMachineBuilder &TMBuilder) {
|
||||
if (CachePath.empty())
|
||||
return;
|
||||
|
||||
@ -306,12 +307,42 @@ public:
|
||||
|
||||
SHA1 Hasher;
|
||||
|
||||
// Include the parts of the LTO configuration that affect code generation.
|
||||
auto AddString = [&](StringRef Str) {
|
||||
Hasher.update(Str);
|
||||
Hasher.update(ArrayRef<uint8_t>{0});
|
||||
};
|
||||
auto AddUnsigned = [&](unsigned I) {
|
||||
uint8_t Data[4];
|
||||
Data[0] = I;
|
||||
Data[1] = I >> 8;
|
||||
Data[2] = I >> 16;
|
||||
Data[3] = I >> 24;
|
||||
Hasher.update(ArrayRef<uint8_t>{Data, 4});
|
||||
};
|
||||
|
||||
// Start with the compiler revision
|
||||
Hasher.update(LLVM_VERSION_STRING);
|
||||
#ifdef HAVE_LLVM_REVISION
|
||||
Hasher.update(LLVM_REVISION);
|
||||
#endif
|
||||
|
||||
// Hash the optimization level and the target machine settings.
|
||||
AddString(TMBuilder.MCpu);
|
||||
// FIXME: Hash more of Options. For now all clients initialize Options from
|
||||
// command-line flags (which is unsupported in production), but may set
|
||||
// RelaxELFRelocations. The clang driver can also pass FunctionSections,
|
||||
// DataSections and DebuggerTuning via command line flags.
|
||||
AddUnsigned(TMBuilder.Options.RelaxELFRelocations);
|
||||
AddUnsigned(TMBuilder.Options.FunctionSections);
|
||||
AddUnsigned(TMBuilder.Options.DataSections);
|
||||
AddUnsigned((unsigned)TMBuilder.Options.DebuggerTuning);
|
||||
AddString(TMBuilder.MAttr);
|
||||
if (TMBuilder.RelocModel)
|
||||
AddUnsigned(*TMBuilder.RelocModel);
|
||||
AddUnsigned(TMBuilder.CGOptLevel);
|
||||
AddUnsigned(OptLevel);
|
||||
|
||||
Hasher.update(ArrayRef<uint8_t>((uint8_t *)&ModHash[0], sizeof(ModHash)));
|
||||
for (auto F : ExportList)
|
||||
// The export list can impact the internalization, be conservative here
|
||||
@ -928,7 +959,8 @@ void ThinLTOCodeGenerator::run() {
|
||||
ModuleCacheEntry CacheEntry(CacheOptions.Path, *Index, ModuleIdentifier,
|
||||
ImportLists[ModuleIdentifier], ExportList,
|
||||
ResolvedODR[ModuleIdentifier],
|
||||
DefinedFunctions, GUIDPreservedSymbols);
|
||||
DefinedFunctions, GUIDPreservedSymbols,
|
||||
OptLevel, TMBuilder);
|
||||
auto CacheEntryPath = CacheEntry.getEntryPath();
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user