summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2017-09-19 21:55:51 +0000
committerQuentin Colombet <qcolombet@apple.com>2017-09-19 21:55:51 +0000
commit7fdaa5e64114bd5b614cff87bc350e4358b95200 (patch)
treeb1ac6890a305d45e78ccd72b7c57c7de903090ac /llvm/lib/CodeGen/MIRPrinter.cpp
parent21a2aa72037649bfd64bda08706c06fb3fc0e9b7 (diff)
downloadbcm5719-llvm-7fdaa5e64114bd5b614cff87bc350e4358b95200.tar.gz
bcm5719-llvm-7fdaa5e64114bd5b614cff87bc350e4358b95200.zip
[MIRPrinter] Print empty successor lists when they cannot be guessed
Unreachable blocks in the machine instr representation are these weird empty blocks with no successors. The MIR printer used to not print empty lists of successors. However, the MIR parser now treats non-printed list of successors as "please guess it for me". As a result, the parser tries to guess the list of successors and given the block is empty, just assumes it falls through the next block (if any). For instance, the following test case used to fail the verifier. The MIR printer would print entry / \ true (def) false (no list of successors) | split.true (use) The MIR parser would understand this: entry / \ true (def) false | / <-- invalid edge split.true (use) Because of the invalid edge, we get the "def does not dominate all uses" error. The fix consists in printing empty successor lists, so that the parser knows what to do for unreachable blocks. rdar://problem/34022159 llvm-svn: 313685
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index db9ccef8a36..6347e6da942 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -598,8 +598,7 @@ void MIPrinter::print(const MachineBasicBlock &MBB) {
bool HasLineAttributes = false;
// Print the successors
bool canPredictProbs = canPredictBranchProbabilities(MBB);
- if (!MBB.succ_empty() && (!SimplifyMIR || !canPredictProbs ||
- !canPredictSuccessors(MBB))) {
+ if (!SimplifyMIR || !canPredictProbs || !canPredictSuccessors(MBB)) {
OS.indent(2) << "successors: ";
for (auto I = MBB.succ_begin(), E = MBB.succ_end(); I != E; ++I) {
if (I != MBB.succ_begin())
OpenPOWER on IntegriCloud