<div dir="ltr">CallSite and CallSiteBase were removed in <a href="https://github.com/llvm/llvm-project/commit/fdbf493a705c">fdbf493a705c</a>. I'm assuming you're working on a branch before that. To future-proof the code, it'd be probably best to not use CallSite, and instead use CallBase (an Instruction, base class to CallInst, CallBrInst or InvokeInst) and get the information from it, e.g. getCalledOperand.<div><br></div><div>For your case, could it be that the use of the function is not a call, but, for example, an expression taking the address of the function? When debugging, I find it useful to call dump() on the various objects of interest, it very quickly reveals what's happening.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 21, 2021 at 3:07 AM Nagaraju Mekala via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi All,<br>
<br>
I have a custom Pass which will identify a few functions in the .cpp<br>
code and process them.<br>
It was working fine for almost all the functions except for a function<br>
which has class objects as its arguments.<br>
<br>
Details:<br>
For a particular function the  CallSite CS(*iUse); CS is zero. When I<br>
debugged the code the CallSite was expecting the *iUse to be InstTy<br>
but this particular function is having the type UnaryConstantExpr. Due<br>
to this the CS is zero.<br>
<br>
I want to understand why this specific function has the UnaryConstantExpr type?<br>
Any reference to documents or links will be a great help.<br>
<br>
CallSite.h:<br>
static CallSiteBase get(ValTy *V) {<br>
    if (InstrTy *II = dyn_cast<InstrTy>(V)) {<br>
<br>
CustomPass:<br>
//aFuncs has the custom functions list from .cpp<br>
for(AFuncList::iterator iFunc=aFuncs.begin(); iFunc!=aFuncs.end(); iFunc++){<br>
      Function *f = *iFunc;<br>
      for(Value::user_iterator iUse = f->user_begin(); iUse !=<br>
f->user_end(); iUse++){<br>
        CallSite CS(*iUse);<br>
        if ( CS ){<br>
          BasicBlock *bb = CS.getInstruction()->getParent();<br>
           -----<br>
           ---<br>
<br>
Please let me know if more details are needed.<br>
<br>
Thanks in Advance,<br>
Nagaraju<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>