mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Don't crash if we are printing an orphaned basic block!
llvm-svn: 10100
This commit is contained in:
parent
f67fef08c2
commit
5ac68ed1bf
@ -750,20 +750,24 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
|
||||
else
|
||||
Out << "<badref>";
|
||||
}
|
||||
|
||||
if (BB != &BB->getParent()->front()) { // Not the entry block?
|
||||
// Output predecessors for the block...
|
||||
Out << "\t\t;";
|
||||
pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
|
||||
|
||||
if (PI == PE) {
|
||||
Out << " No predecessors!";
|
||||
} else {
|
||||
Out << " preds =";
|
||||
writeOperand(*PI, false, true);
|
||||
for (++PI; PI != PE; ++PI) {
|
||||
Out << ",";
|
||||
|
||||
if (BB->getParent() == 0)
|
||||
Out << "\t\t; Error: Block without parent!";
|
||||
else {
|
||||
if (BB != &BB->getParent()->front()) { // Not the entry block?
|
||||
// Output predecessors for the block...
|
||||
Out << "\t\t;";
|
||||
pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
|
||||
|
||||
if (PI == PE) {
|
||||
Out << " No predecessors!";
|
||||
} else {
|
||||
Out << " preds =";
|
||||
writeOperand(*PI, false, true);
|
||||
for (++PI; PI != PE; ++PI) {
|
||||
Out << ",";
|
||||
writeOperand(*PI, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user