[PATCH] D82572: [CallGraph] Add support for callback call sites

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 19:40:37 PDT 2020


jdoerfert added inline comments.


================
Comment at: llvm/include/llvm/Analysis/CallGraph.h:178
   /// and the call graph node being called.
-  using CallRecord = std::pair<WeakTrackingVH, CallGraphNode *>;
+  using CallRecord = std::pair<Optional<WeakTrackingVH>, CallGraphNode *>;
 
----------------
sdmitriev wrote:
> jdoerfert wrote:
> > This change is unrelated, right? Or did I miss where you differentiate between `None` and `nullptr`? If so, we should probably describe here what each means.
> No, it is related. For ‘reference’ edges that are not associated with any call instruction CallRecord is created with the first field set to `None`, while real calls have instruction address there (please see lines 246-247 below). Therefore all real calls are expected to have a value in this field and it is not supposed to be `nullptr`. I will add a comment explaining this.
I see. The comment helps but I might not have phrased my questions the right way. Didn't we already use an explicit `nullptr` as the "call" for the external call edges? That's why I thought you replaced `nullptr` with `none` now and asked if we distinguish between the two. It seems not.

The `nullptr` edge is for example in `llvm/test/Analysis/CallGraph/non-leaf-intrinsics.ll`


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

https://reviews.llvm.org/D82572





More information about the llvm-commits mailing list