[clang] [llvm] Compute GUIDs once and store in metadata (PR #184065)
Owen Rodley via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 22:47:26 PDT 2026
================
@@ -7304,9 +7280,13 @@ ModuleSummaryIndexBitcodeReader::getValueInfoFromValueId(unsigned ValueId) {
void ModuleSummaryIndexBitcodeReader::setValueGUID(
uint64_t ValueID, StringRef ValueName, GlobalValue::LinkageTypes Linkage,
StringRef SourceFileName) {
- std::string GlobalId =
- GlobalValue::getGlobalIdentifier(ValueName, Linkage, SourceFileName);
- auto ValueGUID = GlobalValue::getGUIDAssumingExternalLinkage(GlobalId);
+ GlobalValue::GUID ValueGUID = 0;
+ if (ValueID < DefinedGUIDs.size())
+ ValueGUID = DefinedGUIDs[ValueID];
+ if (ValueGUID == 0)
----------------
orodley wrote:
I think it might be possible in theory? The `DefinedGUIDs` list is just initialised to all zeroes and then we set the GUID for every `ValueID`, as long as it has one. So if a particular value doesn't get an assigned `GUID` because it `isDeclaration` then its entry will be 0. I'll try changing this and seeing if this is ever possible in practice.
https://github.com/llvm/llvm-project/pull/184065
More information about the cfe-commits
mailing list