How to add a pass to the O2 pipeline

Hi,
I would like to add a pass I wrote (using the new pass manager) directly using clang -O2 option, and not using opt -passes.
I tried adding it to buildModuleOptimizationPipeline, but the function never gets called (at least it doesn’t show up in lldb).
Thanks for the help !

EDIT:
I am using llvm 12, and I think clang 12 uses the legacy pass manager by default, and that would explain why the code is not called. Is there a way to change this behaviour ?

-DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=ON