[PATCH] D52894: Update CallSite docs and add a new function (NFC)

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 18 08:05:53 PDT 2018


scott.linder added inline comments.


================
Comment at: include/llvm/IR/CallSite.h:108
+  ///
+  /// See isIndirectCall() for the definition of an indirect call.
   FunTy *getCalledFunction() const {
----------------
efriedma wrote:
> Maybe it would be better to avoid "direct" and "indirect"...?  Maybe just say "Return the function being called if the callee Value is a Function".
One issue is that "direct" and "indirect" are used in similar ways in other places. For example CallGraphSCCPass refers to "devirtualizing" calls which are of the form `call bitcast @func` because `getCalledFunction` stops returning `nullptr`.

I can attempt to find and update all of these comments as well if we think fixing this terminology is useful. I am personally still confused about how these terms are used, and used inconsistently (as you point out below, `getCalledFunction` and `isIndirectCall` disagree on the term and they are in the same class).


================
Comment at: include/llvm/IR/CallSite.h:126
+  /// same function. For example, a call to a bitcast of a function is
+  /// considered indirect.
   bool isIndirectCall() const {
----------------
efriedma wrote:
> This isn't what isIndirectCall actually implements...
Right, I completely missed that a BitCast is a Constant, and also did not mention the specific check for InlineAsm.

When can `getCalledValue` return `nullptr`? And is this definition "correct" for LLVM (e.g. an indirect call is any call which is not one of these cases)?


https://reviews.llvm.org/D52894





More information about the llvm-commits mailing list