diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -3564,6 +3564,7 @@ /// printBasicBlock - This member is called for each basic block in a method. void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { + assert(BB->getParent() && "block without parent!"); bool IsEntryBlock = BB == &BB->getParent()->getEntryBlock(); if (BB->hasName()) { // Print out the label if it exists... Out << "\n"; @@ -3578,10 +3579,7 @@ Out << ":"; } - if (!BB->getParent()) { - Out.PadToColumn(50); - Out << "; Error: Block without parent!"; - } else if (!IsEntryBlock) { + if (!IsEntryBlock) { // Output predecessors for the block. Out.PadToColumn(50); Out << ";";