diff options
author | Xinliang David Li <davidxl@google.com> | 2019-04-24 19:51:16 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2019-04-24 19:51:16 +0000 |
commit | 499c80b89015cf0fa744b228518b5f6632e8c989 (patch) | |
tree | d246a3dcdc237c1f2bb26567f1d64627a6f2fa1d /llvm/lib/Analysis | |
parent | d129ee34a51e44c9d46a1bf646a12dbf9b438996 (diff) | |
download | bcm5719-llvm-499c80b89015cf0fa744b228518b5f6632e8c989.tar.gz bcm5719-llvm-499c80b89015cf0fa744b228518b5f6632e8c989.zip |
Add optional arg to profile count getters to filter
synthetic profile count.
Differential Revision: http://reviews.llvm.org/D61025
llvm-svn: 359131
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfo.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Analysis/ProfileSummaryInfo.cpp | 5 |
3 files changed, 13 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp index 398303dd31b..de183bbde17 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp @@ -203,11 +203,12 @@ BlockFrequency BlockFrequencyInfo::getBlockFreq(const BasicBlock *BB) const { } Optional<uint64_t> -BlockFrequencyInfo::getBlockProfileCount(const BasicBlock *BB) const { +BlockFrequencyInfo::getBlockProfileCount(const BasicBlock *BB, + bool AllowSynthetic) const { if (!BFI) return None; - return BFI->getBlockProfileCount(*getFunction(), BB); + return BFI->getBlockProfileCount(*getFunction(), BB, AllowSynthetic); } Optional<uint64_t> diff --git a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp index f0b9ea6f553..0db6dd04a7e 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp @@ -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. diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 1f9e9813c76..682f15d054d 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -95,7 +95,8 @@ bool ProfileSummaryInfo::computeSummary() { Optional<uint64_t> ProfileSummaryInfo::getProfileCount(const Instruction *Inst, - BlockFrequencyInfo *BFI) { + BlockFrequencyInfo *BFI, + bool AllowSynthetic) { if (!Inst) return None; assert((isa<CallInst>(Inst) || isa<InvokeInst>(Inst)) && @@ -111,7 +112,7 @@ ProfileSummaryInfo::getProfileCount(const Instruction *Inst, return None; } if (BFI) - return BFI->getBlockProfileCount(Inst->getParent()); + return BFI->getBlockProfileCount(Inst->getParent(), AllowSynthetic); return None; } |