Rollup merge of #129353 - krasimirgg:llvm20key, r=nikic

llvm-wrapper: adapt for LLVM 20 API changes

No functional changes intended.

Adapts llvm-wrapper for the LLVM commits 0f22d47a7a and d6d8243dcd.

`@rustbot` label: +llvm-main
r? `@nikic`
This commit is contained in:
Matthias Krüger 2024-08-21 21:58:28 +02:00 committed by GitHub
commit cdec9a0417
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1607,8 +1607,13 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
const auto &ExportList = Data->ExportLists.lookup(ModId); const auto &ExportList = Data->ExportLists.lookup(ModId);
const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId); const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId); const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);
#if LLVM_VERSION_GE(20, 0)
DenseSet<GlobalValue::GUID> CfiFunctionDefs;
DenseSet<GlobalValue::GUID> CfiFunctionDecls;
#else
std::set<GlobalValue::GUID> CfiFunctionDefs; std::set<GlobalValue::GUID> CfiFunctionDefs;
std::set<GlobalValue::GUID> CfiFunctionDecls; std::set<GlobalValue::GUID> CfiFunctionDecls;
#endif
// Based on the 'InProcessThinBackend' constructor in LLVM // Based on the 'InProcessThinBackend' constructor in LLVM
for (auto &Name : Data->Index.cfiFunctionDefs()) for (auto &Name : Data->Index.cfiFunctionDefs())
@ -1618,9 +1623,15 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
CfiFunctionDecls.insert( CfiFunctionDecls.insert(
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name))); GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name)));
#if LLVM_VERSION_GE(20, 0)
Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId, ImportList,
ExportList, ResolvedODR, DefinedGlobals,
CfiFunctionDefs, CfiFunctionDecls);
#else
llvm::computeLTOCacheKey(Key, conf, Data->Index, ModId, ImportList, llvm::computeLTOCacheKey(Key, conf, Data->Index, ModId, ImportList,
ExportList, ResolvedODR, DefinedGlobals, ExportList, ResolvedODR, DefinedGlobals,
CfiFunctionDefs, CfiFunctionDecls); CfiFunctionDefs, CfiFunctionDecls);
#endif
LLVMRustStringWriteImpl(KeyOut, Key.c_str(), Key.size()); LLVMRustStringWriteImpl(KeyOut, Key.c_str(), Key.size());
} }