[llvm-dev] call an existing IPO pass

Fedor Sergeev via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 25 00:46:40 PDT 2019


 > It will be a great help if anyone can point out how to call the 
"CalledValuePropagationPass" in my own pass

You cant call passes from passes.
You can only organize a pipeline, so passes are being run in succession.
Just add CVP into pass manager before your own pass and you should be fine.

Also, passes are not analyses and doing AU.addRequired on a pass is not 
a good idea
(though sometimes this hack might seem to work).

regards,
   Fedor.

On 3/25/19 2:39 AM, Zi Wang via llvm-dev wrote:
> Hi,
>
> I found an existing pass "CalledValuePropagation" that can solve the 
> problem I raised a few days ago regarding the "callees" metadata 
> (https://groups.google.com/forum/#!topic/llvm-dev/yjtZVMH_aC4). Now I 
> have difficulty in calling this pass in my own pass.
>
> In my own pass, I called
> "getAnalysis<CalledValuePropagationPass>()"
>
> and in the "getAnalysisUsage(AnalysisUsage &AU)" function, I called
> "AU.addRequired<CalledValuePropagationPass>();"
>
> I got compilation errors:
> ----------------------------------------------------------
> .....
> include/llvm/PassAnalysisSupport.h:223:38: error: ‘ID’ is not a member 
> of ‘llvm::CalledValuePropagationPass’
>    return getAnalysisID<AnalysisType>(&AnalysisType::ID);\
> .....
> install/include/llvm/PassAnalysisSupport.h:67:39: error: ‘ID’ is not a 
> member of ‘llvm::CalledValuePropagationPass’
>      return addRequiredID(PassClass::ID);
> ......
> -----------------------------------------------------------
>
> Looking at the source code of "CalledValuePropagationPass" 
> (http://llvm.org/doxygen/CalledValuePropagation_8h_source.html), I 
> found that the class "CalledValuePropagationPass" does not have a 
> public member "ID" as the passes in the "Transforms/Utils" directory. 
> All the passes in the "IPO" directory only have a "run()" function 
> that inherits from the "llvm/IR/PassManager.h". I am not quite sure 
> how to invoke these passes in my own pass. I used 
> "UnifyFunctionExitNodes" in my pass and this one worked fine.
>
> It will be a great help if anyone can point out how to call the 
> "CalledValuePropagationPass" in my own pass.
>
> Thanks,
>
> Zi
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list