Zhang via llvm-dev
2019-Dec-20 06:24 UTC
[llvm-dev] What's the go-to method to call other transform passes in LLVM9?
Hi: 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? 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191220/9247bb16/attachment.html>
Michael Kruse via llvm-dev
2019-Dec-20 10:32 UTC
[llvm-dev] What's the go-to method to call other transform passes in LLVM9?
Am Fr., 20. Dez. 2019 um 07:24 Uhr schrieb Zhang via llvm-dev <llvm-dev at lists.llvm.org>:> > Hi: > 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 PMBPasses on the same level are executed in the order they have been added to the pass manager. Do you need a different order? Michael
mayuyu.io via llvm-dev
2019-Dec-20 14:08 UTC
[llvm-dev] What's the go-to method to call other transform passes in LLVM9?
Reevaluating is not my concern since my transform passes likely broke them already anyway. Thanks! Zhang> 在 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>: >> >> Hi: >> 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? > > Michael >
mayuyu.io via llvm-dev
2019-Dec-20 17:07 UTC
[llvm-dev] What's the go-to method to call other transform passes in LLVM9?
Hi: 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. Zhang> 在 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>: >> >> Hi: >> 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? > > Michael >