Call DCE pass in a new pass

Hi ,All:

I’m trying to write a new pass which may introduce some redundant IR, I want to use DCE pass to delete those IR, how can i call the DCE pass after my pass?

Thanks

This is a question of how the pass pipeline is constructed: this is where passes are scheduled.
However in general the implementation of a pass is also exposed as a utility fonction with a public API that can be called directly from your pass.

I don’t find anything about DCE right now however, the only thing available would be to run applyPatternsAndFoldGreedily() with an empty pattern set.

Thanks for your reply, I found that the implementation of DCE in LLVM is really simple, so i just use the code in DCE.cpp :rofl: