[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:41:01 PDT 2019


bogner added inline comments.


================
Comment at: llvm/include/llvm/Analysis/CallGraph.h:88
+  using DummyNodeMapTy =
+      MapVector<const void *, std::unique_ptr<CallGraphNode>>;
+
----------------
Does this really need to be `void *`? AFAICT it's always `CallBase *` or null. If that's not correct, it'd probably still be better to use `PointerUnion` or something.


================
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));
----------------
Maybe I'm misreading this, but isn't `CGN == nullptr` here, given the assignment just above?


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