[PATCH] D52537: Allow null-valued function operands in getCalledFunction()

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 07:13:42 PDT 2018


dstenb added a comment.

In https://reviews.llvm.org/D52537#1246683, @vsk wrote:

> As for the test, I think a unit test might work better (see unittests/IR/MetadataTest.cpp). If something about debug info or BDCE changes, the test will remain useful.


Thanks for the suggestion!

In https://reviews.llvm.org/D52537#1247366, @dexonsmith wrote:

> The change looks correct, but I'm not sure it's the right one.  Looking at Instructions.h at `getCalledFunction()`:
>
>   /// Return the function called, or null if this is an
>   /// indirect function invocation.
>   ///  
>   Function *getCalledFunction() const {
>     return dyn_cast<Function>(Op<-3>());
>   }
>   
>
> it seems like we could just change this to `dyn_cast_or_null`, and that would also match the documentation comment.
>
> I don't have a strong opinion; wouldn't mind @hfinkel's thoughts.


I went ahead and did this change in the latest revision.

(Your suggestion seems reasonable to me, but I don't really know enough about the LLVM framework to say something more concrete about this.)


https://reviews.llvm.org/D52537





More information about the llvm-commits mailing list