diff options
| author | Rahman Lavaee <rahmanl@google.com> | 2020-10-26 16:15:56 -0700 |
|---|---|---|
| committer | Rahman Lavaee <rahmanl@google.com> | 2020-10-26 16:15:56 -0700 |
| commit | 0b2f4cdf2bd4e48974099cd441afaabc18ead227 (patch) | |
| tree | a94f086450ddb54c617ae1b79b6950621c4205d6 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
| parent | d176e13ca55353c7ee8d4da23be6eae9f82a64e1 (diff) | |
Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty.
Sometimes in unoptimized code, we have dangling unreachable basic blocks with no predecessors. Basic block sections should be emitted for those as well. Without this patch, the included test fails with a fatal error in `AsmPrinter::emitBasicBlockEnd`.
Reviewed By: tmsriram
Differential Revision: https://reviews.llvm.org/D89423
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 13ece5ed7d1c..c203ad1e1108 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -266,6 +266,10 @@ bool MachineBasicBlock::hasEHPadSuccessor() const { return false; } +bool MachineBasicBlock::isEntryBlock() const { + return getParent()->begin() == getIterator(); +} + #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MachineBasicBlock::dump() const { print(dbgs()); |
