[llvm-dev] How to express a dependency to, e.g., DCE-pass?

Patrick Boettcher via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 10 06:21:16 PDT 2019

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,

More information about the llvm-dev mailing list