Add optional arg to profile count getters to filter

synthetic profile count.

Differential Revision: http://reviews.llvm.org/D61025


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li
2019-04-24 19:51:16 +00:00
parent c28a81a948
commit a67600cb79
9 changed files with 41 additions and 24 deletions
+7 -4
View File
@@ -557,14 +557,17 @@ BlockFrequencyInfoImplBase::getBlockFreq(const BlockNode &Node) const {
Optional<uint64_t>
BlockFrequencyInfoImplBase::getBlockProfileCount(const Function &F,
const BlockNode &Node) const {
return getProfileCountFromFreq(F, getBlockFreq(Node).getFrequency());
const BlockNode &Node,
bool AllowSynthetic) const {
return getProfileCountFromFreq(F, getBlockFreq(Node).getFrequency(),
AllowSynthetic);
}
Optional<uint64_t>
BlockFrequencyInfoImplBase::getProfileCountFromFreq(const Function &F,
uint64_t Freq) const {
auto EntryCount = F.getEntryCount();
uint64_t Freq,
bool AllowSynthetic) const {
auto EntryCount = F.getEntryCount(AllowSynthetic);
if (!EntryCount)
return None;
// Use 128 bit APInt to do the arithmetic to avoid overflow.