[llvm-dev] call an existing IPO pass

Zi Wang via llvm-dev llvm-dev at lists.llvm.org
Sun Mar 24 16:39:21 PDT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190324/93d90de4/attachment.html>


More information about the llvm-dev mailing list