[profi][NFC] Get rid of afdo_detail::TypeMap
authorAmir Ayupov <aaupov@fb.com>
Tue, 6 Jun 2023 20:41:43 +0000 (13:41 -0700)
committerAmir Ayupov <aaupov@fb.com>
Tue, 6 Jun 2023 20:48:37 +0000 (13:48 -0700)
commitb244a4c4c92150eca3ae5c75323bb91bc4f83155
tree51cdd5ff6c26ca75bf4e115b3c0ee96d36ad1cae
parente412650726b54f2d803902524d7e20e8a4c27a3f
[profi][NFC] Get rid of afdo_detail::TypeMap

Parametrize SampleProfileInference and SampleProfileLoaderBaseImpl by function
type (Function/MachineFunction) instead of block type
(BasicBlock/MachineBasicBlock). Move out specializations to appropriate
locations.

This change makes it possible to use GraphTraits instead of a custom TypeMap and
make SampleProfileInference not dependent on LLVM types, paving the way for
generalizing SampleProfileInference interfaces to BOLT IR types
(BinaryFunction/BinaryBasicBlock) in stale profile matching (D144500).

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D152187
llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
llvm/lib/CodeGen/MIRSampleProfile.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp