[llvm] 3847737 - [CallPrinter] Handle freq = 0 case
Kirill Bobyrev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 17 01:53:10 PDT 2020
Author: Kirill Bobyrev
Date: 2020-06-17T10:52:18+02:00
New Revision: 3847737fa489dc88d1d45bbedc550e87bf88fbe1
URL: https://github.com/llvm/llvm-project/commit/3847737fa489dc88d1d45bbedc550e87bf88fbe1
DIFF: https://github.com/llvm/llvm-project/commit/3847737fa489dc88d1d45bbedc550e87bf88fbe1.diff
LOG: [CallPrinter] Handle freq = 0 case
Improvement of the following revision:
bbc629ebd6429d43cfd72d9a0e2b5ca8a4083b54
This might still be problematic if freq = 0, so it's better to check for
that.
Added:
Modified:
llvm/lib/Analysis/HeatUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/HeatUtils.cpp b/llvm/lib/Analysis/HeatUtils.cpp
index 15d672ffbf9a..01276f880bce 100644
--- a/llvm/lib/Analysis/HeatUtils.cpp
+++ b/llvm/lib/Analysis/HeatUtils.cpp
@@ -62,7 +62,7 @@ uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI) {
std::string getHeatColor(uint64_t freq, uint64_t maxFreq) {
if (freq > maxFreq)
freq = maxFreq;
- double percent = (maxFreq > 0) ? log2(double(freq)) / log2(maxFreq) : 0;
+ double percent = (freq > 0) ? log2(double(freq)) / log2(maxFreq) : 0;
return getHeatColor(percent);
}
More information about the llvm-commits
mailing list