diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
commit | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (patch) | |
tree | 19c69a04768629f2d440944b71cbe90adae0b615 /lib/Support/BranchProbability.cpp | |
parent | 07637c87f826cdf411f0673595e9bc92ebd793f2 (diff) | |
download | FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.zip FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.tar.gz |
Vendor import of llvm trunk r154661:
http://llvm.org/svn/llvm-project/llvm/trunk@r154661
Diffstat (limited to 'lib/Support/BranchProbability.cpp')
-rw-r--r-- | lib/Support/BranchProbability.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/Support/BranchProbability.cpp b/lib/Support/BranchProbability.cpp index 49d04ed..e8b83e5 100644 --- a/lib/Support/BranchProbability.cpp +++ b/lib/Support/BranchProbability.cpp @@ -13,24 +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; -BranchProbability::BranchProbability(uint32_t n, uint32_t d) { - assert(d > 0 && "Denomiator cannot be 0!"); - assert(n <= d && "Probability cannot be bigger than 1!"); - N = n; - D = d; -} - 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 { |