AnalysisUsage & Call Graph SCC Pass Manager

Hello,

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

...
  ModulePass Manager
    FunctionPass Manager
      Preliminary module verification
      Dominator Tree Construction
      Module Verifier
    MyModulePass0
    MyAnalysis
    Basic CallGraph Construction
    MyModulePass1
    MyAnalysis
    MyModulePass2
    Basic CallGraph Construction
    Call Graph SCC Pass Manager
      MyCallGraphSCCPass
    MyModulePass3
    ...

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 ?

Thanks,
Julien

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

Thanks, I filed http://llvm.org/bugs/show_bug.cgi?id=3703 with a simple
test case.

Julien