[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 17 08:52:15 PDT 2024


================
@@ -43,6 +43,57 @@ class YAMLProfileReader : public ProfileReaderBase {
   using ProfileLookupMap =
       DenseMap<uint32_t, yaml::bolt::BinaryFunctionProfile *>;
 
+  /// A class for matching binary functions in functions in the YAML profile.
+  /// First, a call graph is constructed for both profiled and binary functions.
+  /// Then functions are hashed based on the names of their callee/caller
+  /// functions. Finally, functions are matched based on these neighbor hashes.
+  class CallGraphMatcher {
+  public:
+    /// Constructs the call graphs for binary and profiled functions and
+    /// computes neighbor hashes for binary functions.
+    CallGraphMatcher(BinaryContext &BC, yaml::bolt::BinaryProfile &YamlBP,
+                     ProfileLookupMap &IdToYAMLBF);
+
+    /// Returns the YamlBFs adjacent to the parameter YamlBF in the call graph.
+    std::set<yaml::bolt::BinaryFunctionProfile *> *
----------------
aaupov wrote:

Please use `std::optional` type instead of a null-able pointer.

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


More information about the llvm-branch-commits mailing list