Clang options to print the list of passes that's going to be executed for a compile command. Is it `--print-after-all`?

Given a clang compile command like clang --option1 --option2 ... <target>, is there a way (some clang options) to tweak the command (adding / removing some options) to list the passes that were executed in compiling this command?

--print-after-all also prints the compiled output (e.g., IR when --emit-llvm is true), and for the particular use case, only pass names are needed.

Reading the pass manager code takes time and isn’t as reliable as clang prints (if possible at all), since the many options involved complexes reasoning about pass initialization.

1 Like

With the legacy pass manager, adding -mllvm -debug-pass=Arguments would dump out the set of arguments necessary to build the pipeline (or at least close enough).

It looks like someone added -print-pipeline-passes to opt to retain the same functionality, but this functionality isn’t enabled in the clang driver itself. (There’s an open bug on adding something equivalent to -debug-pass for new pass manager here: [PM] Equivalent of -debug-pass=Arguments/-debug-pass=Structure · Issue #28692 · llvm/llvm-project · GitHub).