[llvm-dev] Fwd: call an existing IPO pass

Zi Wang via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 25 01:14:08 PDT 2019


On Mon, Mar 25, 2019 at 3:11 AM Zi Wang <wzahhq9 at gmail.com> wrote:

> Thanks Fedor!
>
> 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?
>
> On Mon, Mar 25, 2019 at 2:46 AM Fedor Sergeev via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>>  > 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
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190325/9974dc38/attachment.html>


More information about the llvm-dev mailing list