Skip to content

Commit

Permalink
[Sink] Don't check BB.empty()
Browse files Browse the repository at this point in the history
As an invariant, BasicBlocks cannot be empty when passed to a transform.
This is not the case for MachineBasicBlocks and the Sink pass was ported
from the MachineSink pass which would explain the check's existence.

llvm-svn: 251057
  • Loading branch information
majnemer committed Oct 22, 2015
1 parent f4fb5f5 commit e0675fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/Sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool Sinking::runOnFunction(Function &F) {

bool Sinking::ProcessBlock(BasicBlock &BB) {
// Can't sink anything out of a block that has less than two successors.
if (BB.getTerminator()->getNumSuccessors() <= 1 || BB.empty()) return false;
if (BB.getTerminator()->getNumSuccessors() <= 1) return false;

// Don't bother sinking code out of unreachable blocks. In addition to being
// unprofitable, it can also lead to infinite looping, because in an
Expand Down

0 comments on commit e0675fb

Please sign in to comment.