This patch implements a proof of concept port of the old PM CGSCC visitation logic to the new PM. It also ports all the remaining CGSCC passes (inliner, argpromotion, prune-eh). I have done some basic sanity checks to make sure things work. Tomorrow I'll add a CC1 flag to clang that allows running new-PM passes and give test-suite a shot.
This was done as a sort of mad dash to get a proof of concept; all the changes are meant to be as mechanical as possible. I fully expect to have to redo every change here incrementally and with proper attention to detail, but seeing it all come together and working is important IMO. Especially the port of the inliner can be done much more cleanly than I have done here.
Most of the patch is just porting the passes and threading state through various places.
But pay attention to include/llvm/Analysis/CGSCCPassManager.h
That is where the real business happens. Especially the "run" methods of ModuleToPostOrderCGSCCPassAdaptor and CGSCCToFunctionPassAdaptor. In total, they are less than 100 lines of code which are at the heart of this patch.