Restrict the definition of loop preheader to avoid EH blocks
Differential Revision: https://reviews.llvm.org/D34487 llvm-svn: 306070
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user