[llvm-dev] What's the go-to method to call other transform passes in LLVM9?
mayuyu.io via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 20 09:07:33 PST 2019
I personally prefer method 2 in my use case, however, I currently modified PassManagerBuilder to inject my pass into the pipeline which means if I create another PassManagerBuilder in my pass it would be a deadloop.
> 在 2019年12月20日，18:32，Michael Kruse <llvmdev at meinersbur.de> 写道：
> Am Fr., 20. Dez. 2019 um 07:24 Uhr schrieb Zhang via llvm-dev
> <llvm-dev at lists.llvm.org>:
>> In my in-house transform passes I needs to properly lower Switch/Invoke and PhiNodes, prior to LLVM9 I just call createLowerSwitchPass() and run it. However in LLVM9 doing this would assert out with error message:
>> Assertion failed: (Resolver && "Pass has not been inserted into a PassManager object!"), function getAnalysis, file \LLVM9/llvm/include/llvm/PassAnalysisSupport.h, line 221.
>> Is there any suggestion on this?
> LowerSwitch requires the LazyValueInfo pass which it requests from the
> pass manager. Since it is not part of a pass manager, you get the
> error. I see two possibilities:
> 1. Just add the LowerSwitch pass after your pass to the pass manager.
> 2. Instantiate a pass manager inside out pass, add LowerSwitch to it,
> and call the pass manager on the function. This will re-evaluate
> LazyValueInfo even if the main pass manger already computed it.
>> And how do I make sure my transform passes in PassManagerBuilder are executed in a given order? Previously I create a dummy pass that calls the actual transform passes and run them in order, then inject this dummy pass into PMB
> Passes on the same level are executed in the order they have been
> added to the pass manager. Do you need a different order?
More information about the llvm-dev