[llvm] [ThinLTO]Sort imported GUIDs before cache key update (PR #92622)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 17:08:43 PDT 2024


================
@@ -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);
+
----------------
MaskRay wrote:

There are quite a few blank lines but I think we can be more dense.

Group coherent code block of multiple lines, probably not just one/two lines.

https://github.com/llvm/llvm-project/pull/92622


More information about the llvm-commits mailing list