Patrick Boettcher via llvm-dev
2019-Oct-10 13:21 UTC
[llvm-dev] How to express a dependency to, e.g., DCE-pass?
Hi list, We wrote a custom transform-pass which transforms code at IR-level. We would like to have it be executed by the pass-manager ideally at the "very end" of all optimization passed. After constant-propagation and dead-code-elimination (and maybe others). However, we're unable to achieve that for the moment. What is the right way to express a dependency or to position the pass? We added INITIALIZE_PASS_DEPENDENCY(ADCELegacyPass) and it seems we need to add something to getAnalysis<>() but everything we tried didn't compile. Furthermore we saw that, when running clang with -mllvm -debug-pass=Structure that there seems to be several optimizations "stages". Our passes are always in the first "stage" whereas the DCE-passes are running in a later stage. Where is our mistake? It seems we are missing some basic knowledge about the PassManager. Thanks in advance for any help. best regards, -- Patrick.
Patrick Boettcher via llvm-dev
2019-Oct-11 13:14 UTC
[llvm-dev] How to express a dependency to, e.g., DCE-pass?
On Thu, 10 Oct 2019 15:21:16 +0200 Patrick Boettcher via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi list, > > We wrote a custom transform-pass which transforms code at IR-level. > > We would like to have it be executed by the pass-manager ideally at > the "very end" of all optimization passed. After constant-propagation > and dead-code-elimination (and maybe others). > > However, we're unable to achieve that for the moment. What is the > right way to express a dependency or to position the pass? > > We added INITIALIZE_PASS_DEPENDENCY(ADCELegacyPass) and it seems we > need to add something to getAnalysis<>() but everything we tried > didn't compile. > > Furthermore we saw that, when running clang with -mllvm > -debug-pass=Structure that there seems to be several optimizations > "stages". Our passes are always in the first "stage" whereas the > DCE-passes are running in a later stage. > > Where is our mistake? It seems we are missing some basic knowledge > about the PassManager.Found a solution fixing our problem. We added the pass to the Pass-Manager (within BackendUtil.cpp) in Clang. Now we moved it to IPC in llvm and there all Passes are available to express dependencies. -- Patrick.