[MBFIWrapper] Add a new function getBlockProfileCount
authorGuozhi Wei <carrot@google.com>
Wed, 23 Sep 2020 16:27:34 +0000 (09:27 -0700)
committerGuozhi Wei <carrot@google.com>
Wed, 23 Sep 2020 16:31:45 +0000 (09:31 -0700)
commitfd75ad86624eaebf21e544335ea28f12e54a5ec1
tree6914fbb905de191aa7c1e8148d8ff24c9c5fa215
parent63998649dd4886ecf9b5c8304173cb0c7357cd5d
[MBFIWrapper] Add a new function getBlockProfileCount

MBFIWrapper keeps track of block frequencies of newly created blocks and
modified blocks, modified block frequencies should also impact block profile
count. This class doesn't provide interface getBlockProfileCount, users can only
use the underlying MBFI to query profile count, the underlying MBFI doesn't know
the modifications made in MBFIWrapper, so it either provides stale profile count
for modified block or simply crashes on new blocks.

So this patch add function getBlockProfileCount to class MBFIWrapper to handle
new blocks or modified blocks.

Differential Revision: https://reviews.llvm.org/D87802
llvm/include/llvm/CodeGen/MBFIWrapper.h
llvm/lib/CodeGen/MBFIWrapper.cpp
llvm/lib/CodeGen/MachineBlockPlacement.cpp