[llvm-dev] How to know the CallInst is a virtual call ?

PenYiWang via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 18 09:53:32 PDT 2020


Hi

I know that a virtual call looks like this :

  %4 = load %class.base*, %class.base** %1, align 8
  %5 = bitcast %class.base* %4 to void (%class.base*)***
  %6 = load void (%class.base*)**, void (%class.base*)*** %5, align 8
  %7 = getelementptr inbounds void (%class.base*)*, void (%class.base*)**
%6, i64 0
  %8 = load void (%class.base*)*, void (%class.base*)** %7, align 8
  call void %8(%class.base* %4)

There may be some action to get function pointer on vtable .

But, when I scan a llvm ir file, if I just see a CallInst and it is an
indirect call

Is there any way to know whether the CallInst is a virtual call or not ?

Thank you~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200619/237dfe1d/attachment.html>


More information about the llvm-dev mailing list