[PATCH] D39339: [CallGraph] Refine call graph for indirect calls with !callees metadata

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 09:59:36 PDT 2019


bogner added inline comments.


================
Comment at: llvm/lib/Analysis/CallGraph.cpp:182-189
+  CGN = llvm::make_unique<CallGraphNode>(nullptr);
+  for (const MDOperand &Op : Callees->operands())
+    if (auto *MDConstant = mdconst::extract_or_null<Constant>(Op)) {
+      auto *F = cast<Function>(MDConstant);
+
+      assert(!F->isIntrinsic());
+      CGN->addCalledFunction(nullptr, getOrInsertFunction(F));
----------------
rudkx wrote:
> bogner wrote:
> > Maybe I'm misreading this, but isn't `CGN == nullptr` here, given the assignment just above?
> `GCN` should be a non-null `CallGraphNode` holding a `Function *` that has a `nullptr` value.
Ah right. In that case, doesn't the node get destroyed when the `unique_ptr` goes out of scope here? You may have meant to use `.release()`, but in that case who owns this object?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D39339/new/

https://reviews.llvm.org/D39339





More information about the llvm-commits mailing list