[llvm] r251057 - [Sink] Don't check BB.empty()

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 13:29:08 PDT 2015


Author: majnemer
Date: Thu Oct 22 15:29:08 2015
New Revision: 251057

URL: http://llvm.org/viewvc/llvm-project?rev=251057&view=rev
Log:
[Sink] Don't check BB.empty()

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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/Sink.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/Sink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Sink.cpp?rev=251057&r1=251056&r2=251057&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Sink.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Sink.cpp Thu Oct 22 15:29:08 2015
@@ -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




More information about the llvm-commits mailing list