[llvm] [ThinLTO]Sort imported GUIDs before cache key update (PR #92622)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 17:01:29 PDT 2024
https://github.com/minglotus-6 created https://github.com/llvm/llvm-project/pull/92622
None
>From 7dc6aec75f1498c56f2893dc7d1feb2965029dca Mon Sep 17 00:00:00 2001
From: mingmingl <mingmingl at google.com>
Date: Fri, 17 May 2024 16:59:43 -0700
Subject: [PATCH] [ThinLTO]Sort imported GUIDs before cache key update
---
llvm/lib/LTO/LTO.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 53060df7f503e..afc687a02d965 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -199,13 +199,21 @@ void llvm::computeLTOCacheKey(
[](const ImportModule &Lhs, const ImportModule &Rhs) -> bool {
return Lhs.getHash() < Rhs.getHash();
});
+ 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)));
AddUint64(Entry.getFunctions().size());
+
+ ImportedGUIDs.clear();
for (auto &Fn : Entry.getFunctions())
- AddUint64(Fn);
+ ImportedGUIDs.push_back(Fn);
+
+ llvm::sort(ImportedGUIDs);
+
+ for (auto &GUID : ImportedGUIDs)
+ AddUint64(GUID);
}
// Include the hash for the resolved ODR.
More information about the llvm-commits
mailing list