Don't transform in another bad case: if the block is empty, it should be
authorChris Lattner <sabre@nondot.org>
Sat, 18 Nov 2006 22:25:39 +0000 (22:25 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Nov 2006 22:25:39 +0000 (22:25 +0000)
simplified before we do this xform so that our cost model is accurate.

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

lib/CodeGen/BranchFolding.cpp

index c69930da81ee34ce7d4a7bba0abea7689fd5d9f4..8ded3cdc64d4633245a067f4a699d16f7e1848e3 100644 (file)
@@ -729,7 +729,8 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
       //
       // In this case, we could actually be moving the return block *into* a
       // loop!
-      if (DoTransform && !MBB->succ_empty() && !CanFallThrough(PriorTBB))
+      if (DoTransform && !MBB->succ_empty() &&
+          (!CanFallThrough(PriorTBB) || PriorTBB->empty()))
         DoTransform = false;