I am trying to get a pass list for O1 level optimization using opt and clang. I am using the following command line
for clang: clang -O1 -mllvm -debug-pass=Arguments helloworld.c
for opt opt -O1 -disable-output -print-pipeline-passes < /dev/null
clang and opt don’t build the exact same pipeline. clang builds an LLVM optimization pipeline internally, which is mostly built off of the items in llvm/lib/Passes/PassBuilderPipelines.cpp. However, clang is free to add its own passes as well, there’s a few of them in clang/lib/CodeGen/BackendUtil.cpp for example.
If you have new enough clang, you can add -mllvm -print-pipeline-passes to a command line to get the pipeline run: Compiler Explorer
Note this only prints out the passes that run in the new pass manager. The legacy pass manager is still used for code generation (approximately that run by llc), which you can query with -mllvm -debug-pass=Structure.