The FunctionSpecialization pass needs loop analysis results for its
cost function. For this purpose, it computes the DominatorTree and
LoopInfo for a function in getSpecializationBonus. This function,
however, is called O(number of call sites x number of arguments), but
the DominatorTree/LoopInfo can be computed just once.
This patch plugs into the PassManager infrastructure to obtain
LoopInfo for a function and removes ad-hoc computation from
getSpecializatioBonus.
Nit: if this is a simple getter function, not calculating anything, we can just pass Solver.getLoopInfo(*F) in here.