aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2016-08-01 02:59:26 +0000
committerSean Silva <chisophugis@gmail.com>2016-08-01 02:59:26 +0000
commit620892432332fe344a7a5520983b09ecbf2e6fb6 (patch)
tree18210e3f5f150a733b3fed429c33cff9faeb4448 /llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
parent52626f132ce456fb6cafefc44cd7c66c01e0bd70 (diff)
downloadllvm-620892432332fe344a7a5520983b09ecbf2e6fb6.zip
llvm-620892432332fe344a7a5520983b09ecbf2e6fb6.tar.gz
llvm-620892432332fe344a7a5520983b09ecbf2e6fb6.tar.bz2
CodeExtractor : Add ability to preserve profile data.
Added ability to estimate the entry count of the extracted function and the branch probabilities of the exit branches. Patch by River Riddle! Differential Revision: https://reviews.llvm.org/D22744 llvm-svn: 277313
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
index 6c0f99f..faf9ecc 100644
--- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
+++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
@@ -175,6 +175,12 @@ Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount(
return MBFI ? MBFI->getBlockProfileCount(*F, MBB) : None;
}
+Optional<uint64_t>
+MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const {
+ const Function *F = MBFI->getFunction()->getFunction();
+ return MBFI ? MBFI->getProfileCountFromFreq(*F, Freq) : None;
+}
+
const MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
return MBFI ? MBFI->getFunction() : nullptr;
}