Is there a way to query a runtime ordering of passes for a given source file?

Hi I would like to query a runtime ordering of the passes but not using opt-bisect-limit=-1, as I do not need the ordering per function/module ( to avoid repetitions), only the schedule or order in which various passes are scheduled, I am experimenting with phase ordering and I need a runtime order in which the passes are scheduled. Is there any clang/opt option that would be usedful besides opt-bisect-limit?

There is -print-pipeline-passes which prints the expanded pipeline as a string (and can be passed back to opt -passes).

1 Like

Hi I got back to my project after a while, at the time I could get the string by now when I try to run it, It just exits silently without giving me the pass pipeline string.

This is not wired to be used with Clang driver I guess. This, and then adding a MPM.printPipeline helped me.

diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index e8f2dc34588c..1e99fb226063 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -141,6 +141,9 @@ static cl::opt<bool> ClSanitizeOnOptimizerEarlyEP(
     cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false));

+namespace llvm {
+extern cl::opt<bool> PrintPipelinePasses;
 namespace {

 // Default filename used for profile generation.