<div dir="ltr"><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 3:11 AM Zi Wang <<a href="mailto:wzahhq9@gmail.com">wzahhq9@gmail.com</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"><div dir="ltr"><div><div dir="auto">Thanks Fedor!</div></div><div dir="auto"><br></div><div>I did not really use PassManager.h in the source code of my pass. I am wondering when you mention "Just add CVP into pass manager before your own pass and you should be fine." Do you mean Pass Manager on the pass source code level, or use "opt" to call CVP first and then call my pass? If it is at the source code level, do you know any pointer on how to arrange passes using PassManager at the source code level?</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 2:46 AM Fedor Sergeev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">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"> > It will be a great help if anyone can point out how to call the <br>
"CalledValuePropagationPass" in my own pass<br>
<br>
You cant call passes from passes.<br>
You can only organize a pipeline, so passes are being run in succession.<br>
Just add CVP into pass manager before your own pass and you should be fine.<br>
<br>
Also, passes are not analyses and doing AU.addRequired on a pass is not <br>
a good idea<br>
(though sometimes this hack might seem to work).<br>
<br>
regards,<br>
   Fedor.<br>
<br>
On 3/25/19 2:39 AM, Zi Wang via llvm-dev wrote:<br>
> Hi,<br>
><br>
> I found an existing pass "CalledValuePropagation" that can solve the <br>
> problem I raised a few days ago regarding the "callees" metadata <br>
> (<a href="https://groups.google.com/forum/#!topic/llvm-dev/yjtZVMH_aC4" rel="noreferrer" target="_blank">https://groups.google.com/forum/#!topic/llvm-dev/yjtZVMH_aC4</a>). Now I <br>
> have difficulty in calling this pass in my own pass.<br>
><br>
> In my own pass, I called<br>
> "getAnalysis<CalledValuePropagationPass>()"<br>
><br>
> and in the "getAnalysisUsage(AnalysisUsage &AU)" function, I called<br>
> "AU.addRequired<CalledValuePropagationPass>();"<br>
><br>
> I got compilation errors:<br>
> ----------------------------------------------------------<br>
> .....<br>
> include/llvm/PassAnalysisSupport.h:223:38: error: ‘ID’ is not a member <br>
> of ‘llvm::CalledValuePropagationPass’<br>
>    return getAnalysisID<AnalysisType>(&AnalysisType::ID);\<br>
> .....<br>
> install/include/llvm/PassAnalysisSupport.h:67:39: error: ‘ID’ is not a <br>
> member of ‘llvm::CalledValuePropagationPass’<br>
>      return addRequiredID(PassClass::ID);<br>
> ......<br>
> -----------------------------------------------------------<br>
><br>
> Looking at the source code of "CalledValuePropagationPass" <br>
> (<a href="http://llvm.org/doxygen/CalledValuePropagation_8h_source.html" rel="noreferrer" target="_blank">http://llvm.org/doxygen/CalledValuePropagation_8h_source.html</a>), I <br>
> found that the class "CalledValuePropagationPass" does not have a <br>
> public member "ID" as the passes in the "Transforms/Utils" directory. <br>
> All the passes in the "IPO" directory only have a "run()" function <br>
> that inherits from the "llvm/IR/PassManager.h". I am not quite sure <br>
> how to invoke these passes in my own pass. I used <br>
> "UnifyFunctionExitNodes" in my pass and this one worked fine.<br>
><br>
> It will be a great help if anyone can point out how to call the <br>
> "CalledValuePropagationPass" in my own pass.<br>
><br>
> Thanks,<br>
><br>
> Zi<br>
><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>
<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></div>
</blockquote></div></div>