[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


================
@@ -50,6 +54,59 @@ llvm::cl::opt<bool> ProfileUseDFS("profile-use-dfs",
 namespace llvm {
 namespace bolt {
 
+void CallGraphMatcher::addBFCGEdges(BinaryContext &BC,
+                                    yaml::bolt::BinaryProfile &YamlBP,
+                                    BinaryFunction *BF) {
+  for (const BinaryBasicBlock &BB : BF->blocks()) {
+    for (const MCInst &Instr : BB) {
+      if (!BC.MIB->isCall(Instr))
+        continue;
+      const MCSymbol *CallSymbol = BC.MIB->getTargetSymbol(Instr);
+      if (!CallSymbol)
+        continue;
+      BinaryData *BD = BC.getBinaryDataByName(CallSymbol->getName());
+      if (!BD)
+        continue;
+      BinaryFunction *CalleeBF = BC.getFunctionForSymbol(BD->getSymbol());
----------------
dcci wrote:

Is it possible to have a caller without a callee?
This sounds like it should be an assertion.

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


More information about the llvm-branch-commits mailing list