aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorDavid Tellenbach <david.tellenbach@arm.com>2019-09-20 13:22:59 +0000
committerDavid Tellenbach <david.tellenbach@arm.com>2019-09-20 13:22:59 +0000
commit2a47c77e720a24f808bf6230d0a56bc969258b86 (patch)
treee44515f084cfca1a9b4ffbcfcda0bfc3ec05b488 /llvm/lib/IR/BasicBlock.cpp
parent4a13c828f6d78e49eabffc7b57f805ca46a2a827 (diff)
downloadllvm-2a47c77e720a24f808bf6230d0a56bc969258b86.zip
llvm-2a47c77e720a24f808bf6230d0a56bc969258b86.tar.gz
llvm-2a47c77e720a24f808bf6230d0a56bc969258b86.tar.bz2
[FastISel] Fix insertion of unconditional branches during FastISel
The insertion of an unconditional branch during FastISel can differ depending on building with or without debug information. This happens because FastISel::fastEmitBranch emits an unconditional branch depending on the size of the current basic block without distinguishing between debug and non-debug instructions. This patch fixes this issue by ignoring debug instructions when getting the size of the basic block. Reviewers: aprantl Reviewed By: aprantl Subscribers: ormris, aprantl, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67703 llvm-svn: 372389
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 3441071..bdee699 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -107,6 +107,13 @@ BasicBlock::instructionsWithoutDebug() {
return make_filter_range(*this, Fn);
}
+filter_iterator<BasicBlock::const_iterator,
+ std::function<bool(const Instruction &)>>::difference_type
+BasicBlock::sizeWithoutDebug() const {
+ return std::distance(instructionsWithoutDebug().begin(),
+ instructionsWithoutDebug().end());
+}
+
void BasicBlock::removeFromParent() {
getParent()->getBasicBlockList().remove(getIterator());
}