mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
[CallPrinter] Handle freq = 0 case
Improvement of the following revision:
bbc629ebd6
This might still be problematic if freq = 0, so it's better to check for
that.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user