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

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,

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.