diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-09 00:12:53 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-09 00:12:53 +0000 |
commit | a37e00968eafc83bbcdc8e31a49767ea3868d762 (patch) | |
tree | b264134df1de1da60400005ada99029b62671466 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 39ec2e95ae6bb24940a1aecdf51d4a096cc0c9de (diff) | |
download | llvm-a37e00968eafc83bbcdc8e31a49767ea3868d762.zip llvm-a37e00968eafc83bbcdc8e31a49767ea3868d762.tar.gz llvm-a37e00968eafc83bbcdc8e31a49767ea3868d762.tar.bz2 |
[CodeGen] Only print successors when the list is not empty
Follow-up of r324685.
llvm-svn: 324686
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index f2f84cf..8f4d9b7 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -334,27 +334,30 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, OS << '\n'; } - // Print the successors - OS.indent(2) << "successors: "; - for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { - if (I != succ_begin()) - OS << ", "; - OS << printMBBReference(**I); - 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 (!succ_empty()) { + // Print the successors + OS.indent(2) << "successors: "; + for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { + if (I != succ_begin()) + OS << ", "; + OS << printMBBReference(**I); + 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) + << ')'; + } + OS << '\n'; } // Print the preds of this block according to the CFG. |