[SampleFDO][NFC] Refactor: make SampleProfileLoaderBaseImpl a template class
authorRong Xu <xur@google.com>
Sat, 20 Feb 2021 00:03:20 +0000 (16:03 -0800)
committerRong Xu <xur@google.com>
Thu, 25 Feb 2021 16:26:17 +0000 (08:26 -0800)
commit6103b6ad69fed0fe300f518b5115837cf6b74148
treef0aa16d6e3bd0b16df4ae31768aec7ca20e06790
parentebca222b65cb847f7bf4ee3da1dd7e2df35d0338
[SampleFDO][NFC] Refactor: make SampleProfileLoaderBaseImpl a template class

This patch makes SampleProfileLoaderBaseImpl a template class so it
can be used in CodeGen transformation.

Noticeable changes:
 * use one template parameter and use IRTraits to get other used
   types an type specific functions.
 * 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.

Differential Revision: https://reviews.llvm.org/D96981
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
llvm/lib/Transforms/IPO/SampleProfile.cpp