summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/BranchProbability.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-12-01 03:49:42 +0000
committerHans Wennborg <hans@hanshq.net>2015-12-01 03:49:42 +0000
commit1dbaf67537327eb4e34a80c11503bf06e18811e1 (patch)
tree16aa75fee63a8fc80ed124a12c7ce2f3932358b9 /llvm/lib/Support/BranchProbability.cpp
parent64daf7b1a5c24fe09045dc15b2bc55cc702633e1 (diff)
downloadbcm5719-llvm-1dbaf67537327eb4e34a80c11503bf06e18811e1.tar.gz
bcm5719-llvm-1dbaf67537327eb4e34a80c11503bf06e18811e1.zip
Revert r254348: "Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces."
and the follow-up r254356: "Fix a bug in MachineBlockPlacement that may cause assertion failure during BranchProbability construction." Asserts were firing in Chromium builds. See PR25687. llvm-svn: 254366
Diffstat (limited to 'llvm/lib/Support/BranchProbability.cpp')
-rw-r--r--llvm/lib/Support/BranchProbability.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/llvm/lib/Support/BranchProbability.cpp b/llvm/lib/Support/BranchProbability.cpp
index 771d02c0aa3..3b0f6e6f06e 100644
--- a/llvm/lib/Support/BranchProbability.cpp
+++ b/llvm/lib/Support/BranchProbability.cpp
@@ -22,14 +22,11 @@ using namespace llvm;
const uint32_t BranchProbability::D;
raw_ostream &BranchProbability::print(raw_ostream &OS) const {
- if (isUnknown())
- return OS << "?%";
-
// Get a percentage rounded to two decimal digits. This avoids
// implementation-defined rounding inside printf.
double Percent = rint(((double)N / D) * 100.0 * 100.0) / 100.0;
- return OS << format("0x%08" PRIx32 " / 0x%08" PRIx32 " = %.2f%%", N, D,
- Percent);
+ OS << format("0x%08" PRIx32 " / 0x%08" PRIx32 " = %.2f%%", N, D, Percent);
+ return OS;
}
void BranchProbability::dump() const { print(dbgs()) << '\n'; }
@@ -46,19 +43,6 @@ BranchProbability::BranchProbability(uint32_t Numerator, uint32_t Denominator) {
}
}
-BranchProbability
-BranchProbability::getBranchProbability(uint64_t Numerator,
- uint64_t Denominator) {
- assert(Numerator <= Denominator && "Probability cannot be bigger than 1!");
- // Scale down Denominator to fit in a 32-bit integer.
- int Scale = 0;
- while (Denominator > UINT32_MAX) {
- Denominator >>= 1;
- Scale++;
- }
- return BranchProbability(Numerator >> Scale, Denominator);
-}
-
// If ConstD is not zero, then replace D by ConstD so that division and modulo
// operations by D can be optimized, in case this function is not inlined by the
// compiler.
OpenPOWER on IntegriCloud