[llvm-branch-commits] [llvm] [BOLT][NFC] Track fragment relationships using EquivalenceClasses (PR #99979)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 22 20:50:19 PDT 2024


================
@@ -241,6 +242,10 @@ class BinaryContext {
   /// Function fragments to skip.
   std::unordered_set<BinaryFunction *> FragmentsToSkip;
 
+  /// Fragment equivalence classes to query belonging to the same "family" in
+  /// presence of multiple fragments/multiple parents.
+  EquivalenceClasses<const BinaryFunction *> FragmentClasses;
----------------
aaupov wrote:

It's a set that only keeps a copy of entry (a pointer in our case):

https://github.com/llvm/llvm-project/blob/73ffeeab12d54211fd838d6ff988d111369ea196/llvm/include/llvm/ADT/EquivalenceClasses.h#L26-L35

Moreover, we will only insert fragments into it, so it shouldn't be too expensive even for the largest binaries (we split up to 10s of thousands of functions).

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


More information about the llvm-branch-commits mailing list