aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2016-08-02 02:15:45 +0000
committerSean Silva <chisophugis@gmail.com>2016-08-02 02:15:45 +0000
commitf801575fd059cbfe17b38a8bf1cb3e2de585fb20 (patch)
tree40f70936fa434d9649cd297255c914757e9b957a /llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
parent07784904282c8b0793b0edfdc0220eadfadb205c (diff)
downloadllvm-f801575fd059cbfe17b38a8bf1cb3e2de585fb20.zip
llvm-f801575fd059cbfe17b38a8bf1cb3e2de585fb20.tar.gz
llvm-f801575fd059cbfe17b38a8bf1cb3e2de585fb20.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: 277411
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;
}