[llvm] fbd3bb4 - [NFC][AssemblyWriter] Allow AssemblyWriter::printBasicBlock() to print blocks that don't have parents.
Aditya Nandakumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 20 15:47:19 PDT 2021
Author: Aditya Nandakumar
Date: 2021-07-20T15:46:31-07:00
New Revision: fbd3bb4365e145a5033fdeea0ede978304d22d68
URL: https://github.com/llvm/llvm-project/commit/fbd3bb4365e145a5033fdeea0ede978304d22d68
DIFF: https://github.com/llvm/llvm-project/commit/fbd3bb4365e145a5033fdeea0ede978304d22d68.diff
LOG: [NFC][AssemblyWriter] Allow AssemblyWriter::printBasicBlock() to print blocks that don't have parents.
Remove the assert in AssemblyWriter::printBasicBlock() and
in BasicBlock::isEntryBlock() that require blocks to have parents.
Instead, have BasicBlock::isEntryBlock() return false for unattached
blocks. This allows us to call these functions for blocks that are
not yet added to a module which is a useful debugging capability.
Committing for xiaoqing_wu
https://reviews.llvm.org/D106127k
Added:
Modified:
llvm/lib/IR/AsmWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 5adc24e84b00..69e2d85e58fe 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -3846,8 +3846,7 @@ void AssemblyWriter::printArgument(const Argument *Arg, AttributeSet Attrs) {
/// printBasicBlock - This member is called for each basic block in a method.
void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
- assert(BB && BB->getParent() && "block without parent!");
- bool IsEntryBlock = BB->isEntryBlock();
+ bool IsEntryBlock = BB->getParent() && BB->isEntryBlock();
if (BB->hasName()) { // Print out the label if it exists...
Out << "\n";
PrintLLVMName(Out, BB->getName(), LabelPrefix);
More information about the llvm-commits
mailing list