summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2017-06-22 23:27:16 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2017-06-22 23:27:16 +0000
commitd49711996f94cc73908d03d51938ffaaa40c3da9 (patch)
tree746c8477aa8c0030daf60acf094072faa3ba77d7 /llvm/lib/IR/BasicBlock.cpp
parent08b20356c3f3aa3a7442bd4c2a0d7f3bd294ad8f (diff)
downloadbcm5719-llvm-d49711996f94cc73908d03d51938ffaaa40c3da9.tar.gz
bcm5719-llvm-d49711996f94cc73908d03d51938ffaaa40c3da9.zip
Restrict the definition of loop preheader to avoid EH blocks
Differential Revision: https://reviews.llvm.org/D34487 llvm-svn: 306070
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 1f8659d4e2c..2b780adf6c6 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -355,6 +355,19 @@ bool BasicBlock::canSplitPredecessors() const {
return true;
}
+bool BasicBlock::isLegalToHoistInto() const {
+ auto *Term = getTerminator();
+ // No terminator means the block is under construction.
+ if (!Term)
+ return true;
+
+ // If the block has no successors, there can be no instructions to hoist.
+ assert(Term->getNumSuccessors() > 0);
+
+ // Instructions should not be hoisted across exception handling boundaries.
+ return !Term->isExceptional();
+}
+
/// This splits a basic block into two at the specified
/// instruction. Note that all instructions BEFORE the specified iterator stay
/// as part of the original basic block, an unconditional branch is added to
OpenPOWER on IntegriCloud