This patch makes SampleProfileLoaderBaseImpl a template class so it can be
used in CodeGen transformation.
Noticeable changes:
- use one template parameter and use a typemap to get other used types.
- use a wrapper function getFunction to get IR level function.
- use a wrapper function getEntryBB to get first BB as MachineBasicBlock does not have this API.
- remove the temporary "inline" keywords in previous refactor patch.
- change the template function findEquivalencesFor to a regular function. This function has a single caller with type of PostDominatorTree. It's simpler to use the type directly because MachinePostDominatorTree is not a derived type of template DominatorTreeBase.
This can be reduced to a declaration - might make for better compilation errors if the template is used without a specialization.