summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
diff options
context:
space:
mode:
authorEaswaran Raman <eraman@google.com>2018-02-22 19:44:08 +0000
committerEaswaran Raman <eraman@google.com>2018-02-22 19:44:08 +0000
commit385d8ea8b5dc5d6b348c4a62d159b432bc19b1e7 (patch)
treea1c5d6b00ba5a3a29a8e48077f0a8792b86aec89 /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
parentbeda214996f6b4ed426490ed853bf0a5912a2c7d (diff)
downloadbcm5719-llvm-385d8ea8b5dc5d6b348c4a62d159b432bc19b1e7.tar.gz
bcm5719-llvm-385d8ea8b5dc5d6b348c4a62d159b432bc19b1e7.zip
[ThinLTO] Represent relative BF using a scaled representation .
Summary: The current integer representation of relative block frequency prevents representing relative block frequencies below 1. This change uses a 8 of the 29 bits to represent the decimal part by using a fixed scale of -8. Reviewers: tejohnson, davidxl Subscribers: mehdi_amini, inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D43520 llvm-svn: 325823
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 9293f603479..4a84816f616 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -279,17 +279,9 @@ computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
// Add the relative block frequency to CalleeInfo if there is no profile
// information.
if (BFI != nullptr && Hotness == CalleeInfo::HotnessType::Unknown) {
- auto BBFreq = BFI->getBlockFreq(&BB).getFrequency();
- // FIXME: This might need some scaling to prevent BBFreq values from
- // being rounded down to 0.
- auto EntryFreq = BFI->getEntryFreq();
- // Block frequencies can be directly set for a block and so we need to
- // handle the case of entry frequency being 0.
- if (EntryFreq)
- BBFreq /= EntryFreq;
- else
- BBFreq = 0;
- ValueInfo.updateRelBlockFreq(BBFreq);
+ uint64_t BBFreq = BFI->getBlockFreq(&BB).getFrequency();
+ uint64_t EntryFreq = BFI->getEntryFreq();
+ ValueInfo.updateRelBlockFreq(BBFreq, EntryFreq);
}
} else {
// Skip inline assembly calls.
OpenPOWER on IntegriCloud