[llvm-commits] [llvm] r142752 - /llvm/trunk/lib/Support/BranchProbability.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun Oct 23 04:32:54 PDT 2011
Author: d0k
Date: Sun Oct 23 06:32:54 2011
New Revision: 142752
URL: http://llvm.org/viewvc/llvm-project?rev=142752&view=rev
Log:
Print branch probabilities as percentages.
50% is much more readable than 5.000000e-01.
Modified:
llvm/trunk/lib/Support/BranchProbability.cpp
Modified: llvm/trunk/lib/Support/BranchProbability.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/BranchProbability.cpp?rev=142752&r1=142751&r2=142752&view=diff
==============================================================================
--- llvm/trunk/lib/Support/BranchProbability.cpp (original)
+++ llvm/trunk/lib/Support/BranchProbability.cpp Sun Oct 23 06:32:54 2011
@@ -13,17 +13,17 @@
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
void BranchProbability::print(raw_ostream &OS) const {
- OS << N << " / " << D << " = " << ((double)N / D);
+ OS << N << " / " << D << " = " << format("%g%%", ((double)N / D) * 100.0);
}
void BranchProbability::dump() const {
- print(dbgs());
- dbgs() << "\n";
+ dbgs() << *this << '\n';
}
namespace llvm {
More information about the llvm-commits
mailing list