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

Davide Italiano via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 15 11:21:12 PDT 2024


================
@@ -446,6 +503,56 @@ size_t YAMLProfileReader::matchWithLTOCommonName() {
   return MatchedWithLTOCommonName;
 }
 
+size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) {
+  if (!opts::MatchWithCallGraph)
+    return 0;
+
+  size_t MatchedWithCallGraph = 0;
+  CGMatcher.computeBFNeighborHashes(BC);
+  CGMatcher.constructYAMLFCG(YamlBP, IdToYamLBF);
+
+  // Matches YAMLBF to BFs with neighbor hashes.
+  for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
+    if (YamlBF.Used)
+      continue;
+    auto It = CGMatcher.YamlBFAdjacencyMap.find(&YamlBF);
+    if (It == CGMatcher.YamlBFAdjacencyMap.end())
+      continue;
+    // Computes profiled function's neighbor hash.
+    std::set<yaml::bolt::BinaryFunctionProfile *> &AdjacentFunctions =
+        It->second;
+    std::string AdjacentFunctionHashStr;
+    for (auto &AdjacentFunction : AdjacentFunctions) {
----------------
dcci wrote:

Single line generally bodies of conditionals don't have braces in LLVM

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


More information about the llvm-branch-commits mailing list