summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BlockFrequencyInfo.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-06-22 17:12:12 +0000
committerXinliang David Li <davidxl@google.com>2016-06-22 17:12:12 +0000
commitb12b353a4103f88ce635a609b3513b5a3b7f6e70 (patch)
tree8c7500b558599ca1844c8e1ac40188308cc2bbc0 /llvm/lib/Analysis/BlockFrequencyInfo.cpp
parent9d5057cce535bf3b6e80b294325beb4ffbc18980 (diff)
downloadbcm5719-llvm-b12b353a4103f88ce635a609b3513b5a3b7f6e70.tar.gz
bcm5719-llvm-b12b353a4103f88ce635a609b3513b5a3b7f6e70.zip
[BFI]: NFC refactoring
move getBlockProfileCount implementation to the base class so that MBFI can share too. llvm-svn: 273442
Diffstat (limited to 'llvm/lib/Analysis/BlockFrequencyInfo.cpp')
-rw-r--r--llvm/lib/Analysis/BlockFrequencyInfo.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
index a0c472d7c72..ac7f6e28b3d 100644
--- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp
+++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
@@ -140,20 +140,13 @@ BlockFrequency BlockFrequencyInfo::getBlockFreq(const BasicBlock *BB) const {
Optional<uint64_t>
BlockFrequencyInfo::getBlockProfileCount(const BasicBlock *BB) const {
- auto EntryCount = getFunction()->getEntryCount();
- if (!EntryCount)
+ if (!BFI)
return None;
- // Use 128 bit APInt to do the arithmetic to avoid overflow.
- APInt BlockCount(128, EntryCount.getValue());
- APInt BlockFreq(128, getBlockFreq(BB).getFrequency());
- APInt EntryFreq(128, getEntryFreq());
- BlockCount *= BlockFreq;
- BlockCount = BlockCount.udiv(EntryFreq);
- return BlockCount.getLimitedValue();
+
+ return BFI->getBlockProfileCount(*getFunction(), BB);
}
-void BlockFrequencyInfo::setBlockFreq(const BasicBlock *BB,
- uint64_t Freq) {
+void BlockFrequencyInfo::setBlockFreq(const BasicBlock *BB, uint64_t Freq) {
assert(BFI && "Expected analysis to be available");
BFI->setBlockFreq(BB, Freq);
}
OpenPOWER on IntegriCloud