AnalysisUsage & Call Graph SCC Pass Manager


I have the following sequence of passes (using --debug-pass=Structure):

  ModulePass Manager
    FunctionPass Manager
      Preliminary module verification
      Dominator Tree Construction
      Module Verifier
    Basic CallGraph Construction
    Basic CallGraph Construction
    Call Graph SCC Pass Manager

I have the following analysis usages:

MyModulePass0 does not require anything and does not preserve anything.
MyModulePass1 requires MyAnalysis & Callgraph but does not preserve them.
MyModulePass2 requires MyAnalysis and preserves it.
MyCallGraphSCCPass requires MyAnalysis but does not preserve it.
MyModulePass3 requires MyAnalysis and preserves it.

I am expecting MyAnalysis to be re-scheduled between MyCallGraphSCCPass and
MyModulePass3 but it's not happening.

If I set MyModulePass3 to not preserve MyAnalysis, then I see MyAnalysis
re-scheduled after MyModulePass3.

It seems like the fact that MyAnalysis is not preserved by MyCallGraphSCCPass
is somehow not propagated outside the Call Graph SCC Pass Manager.

Is there something wrong with that sequence ?


It is a bug. CGPassManager is incorrectly claiming that it is preserving all analysis info.

Thanks, I filed with a simple
test case.