summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/BlockFrequency.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Support/BlockFrequency.cpp b/llvm/lib/Support/BlockFrequency.cpp
index 84a993e3e5b..572dbf57654 100644
--- a/llvm/lib/Support/BlockFrequency.cpp
+++ b/llvm/lib/Support/BlockFrequency.cpp
@@ -117,7 +117,16 @@ BlockFrequency::operator+(const BlockFrequency &Prob) const {
}
void BlockFrequency::print(raw_ostream &OS) const {
- OS << Frequency;
+ // Convert fixed-point number to decimal.
+ OS << Frequency / getEntryFrequency() << ".";
+ uint64_t Rem = Frequency % getEntryFrequency();
+ uint64_t Eps = 1;
+ do {
+ Rem *= 10;
+ Eps *= 10;
+ OS << Rem / getEntryFrequency();
+ Rem = Rem % getEntryFrequency();
+ } while (Rem >= Eps/2);
}
namespace llvm {
OpenPOWER on IntegriCloud