FunctionPass Analysis is not saved after ModulePasses run?

Hi,

I have a problem with the following scenario:

I use the ProfileEstimatorPass to get ProfileInfo and verifiy this info with the ProfileVerifierPass. (Please bear with me, its not about the profiling but about the Pass interaction.) Then the LowerSetJumpPass is executed and I want to verify that the esimtated ProfileInfo survives this pass by calling again the ProfileVerifierPass. This is what it looks like:

No Profile Information
   ModulePass Manager
     FunctionPass Manager
       Dominator Tree Construction
       Natural Loop Information
       Profiling information estimator
       Profiling information verifier
     Lower Set Jump
     FunctionPass Manager
       Profiling information verifier
       Preliminary module verification
       Dominator Tree Construction
       Module Verifier
     Bitcode Writer

Unfortunatelly the second execution of the ProfileVerifierPass does not access the ProfileInfo generated by the ProfileEstimator but the one provided by the default ProfileInfo provider (the NoProfileInfo pass).

Even telling the PassManager that LowerSetJumpPass preserves the ProfileInfo (AU.addPreserved<ProfileInfo>():wink: does not change this behavior.

Is this intentional? I'm currently modifying passes to preserve ProfileInfo through the whole compilation, to be available in the backend so this is a little counter-productive :slight_smile:

Is it necessary to add the AU.addPreserved<ProfileInfo>(); to all passes in order for the info to life on?

Thanks, Andi

I have not studied Profile* passes in detail but, if you have function
F1 and F2 in your module then execution sequence is

No Profile Information
  ModulePass Manager
    FunctionPass Manager
      Dominator Tree Construction - F1
      Natural Loop Information - F1
      Profiling information estimator - F1
      Profiling information verifier - F1

      Dominator Tree Construction - F2
      Natural Loop Information - F2
      Profiling information estimator - F2
      Profiling information verifier - F2

    Lower Set Jump - F1 & F2

At this point, last run of profile information estimator operated on
F2 and it was released at then end of FunctionPass manager before
Lower Set Jump pass run.

    FunctionPass Manager
      Profiling information verifier - F1
      Preliminary module verification - F1

Use -debug-pass=Details command line option to understand pass
execution sequence.