[llvm-dev] How to express a dependency to, e.g., DCE-pass?
Patrick Boettcher via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 11 06:14:37 PDT 2019
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.
More information about the llvm-dev