[Sink] Don't check BB.empty()
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 22 Oct 2015 20:29:08 +0000 (20:29 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 22 Oct 2015 20:29:08 +0000 (20:29 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251057 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/Sink.cpp

index 8b916347999cd15ca367520950c399273e17a822..f6ccd999ea008273d625e2f81738f6d4a3ee82ea 100644 (file)
@@ -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