So I got very mixed results.
With the CallGraphSCCPass, both
addRequired<MemoryDependenceAnalysis> fail at runtime. The LLVM core has just two CallGraphSCCPasses and neither uses neither analyses, so it’s hard to find a valid example.
I transformed the pass into a ModulePass, using scc_iterator as shown in CGPassManager to process functions in order, and the situation isn’t a whole lot better.
addRequired<CallGraphWrapperPass>() failed on me, even though at first glance, CGPassManager doesn’t seem to be doing anything that I’m not doing. This is relatively easily bypassed by creating the CallGraph from runOnModule.
addRequired<MemoryDependenceAnalysis>() fails with this error message:
Pass ‘My Pass’ is not initialized.
Verify if there is a pass dependency cycle.
Dominator Tree Construction
Assertion failed: (PI && “Expected required passes to be initialized”), function schedulePass, file LegacyPassManager.cpp, line 641.
“Dominator Tree Construction” disappears from the error message (leaving an empty list of required passes) if I move its
addRequired after MemDep’s.
addRequired<DominatorTreeWrapperPass>() worked instantly, so there’s that, I suppose.
This all looks like rather basic things to do with the pass architecture, and I can’t seem to find documentation explaining which analyses can be used in which types of passes. As I can only find examples of MemDep in FunctionPasses, I’ll probably switch over to that, but this is going to be frustrating when I’ll need call graph SCC information. Anyone has a better idea?
I should note that I’m not using the INITIALIZE_PASS macros because I have no idea how they mesh with RegisterPass. I’m seeing that the passes that use these have INITIALIZE_PASS_DEPENDENCY macros and it makes me a little nervous, but the resulting function for my pass is seemingly never called.