How passes handle inherited analyses

I’ve been looking at some issues with how the PassManager works with AliasAnalysis, specifically with GlobalsModRef. I’ve noticed that for a Function Pass (in IR/LegacyPassManager.cpp), in the function FunctionPass::assignPassManager() there is a call to

FPP->populateInheritedAnalysis(PMS);

whereas for a CallGraphSCC Pass (in Analysis/IPA/CallGraphSCCPass.cpp) there is no call to populateInheritedAnalysis().

This seems to ultimately result in the GlobalsModRef alias analysis information being used for all subsequent CallGraphSCC passes, because they don’t look for inherited analyses to remove (not preserve) after their pass. While for FunctionPasses, the GlobalsModRef alias analysis info is always removed (not preserved) because there is no way to preserve it. Even if a Function Pass indicates it preserves AliasAnalysis, it seems that only the AliasAnalysis that belongs to the FunctionPass Manager is the one that gets preserved, not the parent ModulePass Manager’s. Therefore the inherited analyses (from the AliasAnalysis group) are removed.

Is this how it is supposed to work? It seems that it will severely limit the usefulness of GlobalsModRef if it cannot be used on FunctionPasses that preserve AliasAnalysis. Perhaps I am missing something basic.

Daniel