[PATCH] D108092: [AsmPrinter] fix nullptr dereference for MBBs with hasAddressTaken property without BB
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 16 15:32:25 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG913b5d2f7af7: [AsmPrinter] fix nullptr dereference for MBBs with hasAddressTaken property… (authored by ivafanas, committed by rnk).
Changed prior to commit:
https://reviews.llvm.org/D108092?vs=366512&id=366755#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108092/new/
https://reviews.llvm.org/D108092
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -3270,21 +3270,21 @@
// reference the block. It is possible that there is more than one label
// here, because multiple LLVM BB's may have been RAUW'd to this block after
// the references were generated.
+ const BasicBlock *BB = MBB.getBasicBlock();
if (MBB.hasAddressTaken()) {
- const BasicBlock *BB = MBB.getBasicBlock();
if (isVerbose())
OutStreamer->AddComment("Block address taken");
// MBBs can have their address taken as part of CodeGen without having
// their corresponding BB's address taken in IR
- if (BB->hasAddressTaken())
+ if (BB && BB->hasAddressTaken())
for (MCSymbol *Sym : MMI->getAddrLabelSymbolToEmit(BB))
OutStreamer->emitLabel(Sym);
}
// Print some verbose block comments.
if (isVerbose()) {
- if (const BasicBlock *BB = MBB.getBasicBlock()) {
+ if (BB) {
if (BB->hasName()) {
BB->printAsOperand(OutStreamer->GetCommentOS(),
/*PrintType=*/false, BB->getModule());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108092.366755.patch
Type: text/x-patch
Size: 1229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210816/1aac5687/attachment.bin>
More information about the llvm-commits
mailing list