summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-02-09 00:40:57 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-02-09 00:40:57 +0000
commit7d3dde3c6b31b513a9c3e6b8d9cf8acc530dbab0 (patch)
treead85a4f8ac3b3a978969d23090e8421d34e2af5f /llvm/lib/CodeGen/MachineBasicBlock.cpp
parentb75a3f04ecc80f967454529a6d3f4911523a78f5 (diff)
downloadbcm5719-llvm-7d3dde3c6b31b513a9c3e6b8d9cf8acc530dbab0.tar.gz
bcm5719-llvm-7d3dde3c6b31b513a9c3e6b8d9cf8acc530dbab0.zip
[CodeGen] Don't compute BranchProbability for MBB::print
Avoid re-computing BP only to print successor probabilities in -debug printing. llvm-svn: 324690
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 8f4d9b7a053..76ed383ac3f 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -341,23 +341,27 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
if (I != succ_begin())
OS << ", ";
OS << printMBBReference(**I);
- OS << '(' << format("0x%08" PRIx32, getSuccProbability(I).getNumerator())
- << ')';
+ if (!Probs.empty())
+ OS << '('
+ << format("0x%08" PRIx32, getSuccProbability(I).getNumerator())
+ << ')';
}
- // Print human readable probabilities as comments.
- OS << "; ";
- for (auto I = succ_begin(), E = succ_end(); I != E; ++I) {
- const BranchProbability &BP = *getProbabilityIterator(I);
- if (I != succ_begin())
- OS << ", ";
- OS << printMBBReference(**I) << '('
- << format("%.2f%%",
- rint(((double)BP.getNumerator() / BP.getDenominator()) *
- 100.0 * 100.0) /
- 100.0)
- << ')';
+ if (!Probs.empty()) {
+ // Print human readable probabilities as comments.
+ OS << "; ";
+ for (auto I = succ_begin(), E = succ_end(); I != E; ++I) {
+ const BranchProbability &BP = *getProbabilityIterator(I);
+ if (I != succ_begin())
+ OS << ", ";
+ OS << printMBBReference(**I) << '('
+ << format("%.2f%%",
+ rint(((double)BP.getNumerator() / BP.getDenominator()) *
+ 100.0 * 100.0) /
+ 100.0)
+ << ')';
+ }
+ OS << '\n';
}
- OS << '\n';
}
// Print the preds of this block according to the CFG.
OpenPOWER on IntegriCloud