[PATCH] D106127: Allow AssemblyWriter::printBasicBlock() to print blocks that don't have parents.
Xiaoqing Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 22:21:02 PDT 2021
xiaoqing_wu updated this revision to Diff 359220.
xiaoqing_wu added a comment.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
This version contains the correct diff.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106127/new/
https://reviews.llvm.org/D106127
Files:
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/BasicBlock.cpp
Index: llvm/lib/IR/BasicBlock.cpp
===================================================================
--- llvm/lib/IR/BasicBlock.cpp
+++ llvm/lib/IR/BasicBlock.cpp
@@ -374,7 +374,8 @@
bool BasicBlock::isEntryBlock() const {
const Function *F = getParent();
- assert(F && "Block must have a parent function to use this API");
+ if (F == nullptr)
+ return false;
return this == &F->getEntryBlock();
}
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -3846,7 +3846,6 @@
/// 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();
if (BB->hasName()) { // Print out the label if it exists...
Out << "\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106127.359220.patch
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/cd66926f/attachment.bin>
More information about the llvm-commits
mailing list