summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-18 22:25:39 +0000
committerChris Lattner <sabre@nondot.org>2006-11-18 22:25:39 +0000
commitea017f66f709b32e900d3203bf371193d29d522a (patch)
tree92481b5eab65caf8a9a95b17299c3ff1bf3abaa3 /llvm/lib/CodeGen/BranchFolding.cpp
parent56ec81ff731c4f515eb59faf8139b93179216c13 (diff)
downloadbcm5719-llvm-ea017f66f709b32e900d3203bf371193d29d522a.tar.gz
bcm5719-llvm-ea017f66f709b32e900d3203bf371193d29d522a.zip
Don't transform in another bad case: if the block is empty, it should be
simplified before we do this xform so that our cost model is accurate. llvm-svn: 31864
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index c69930da81e..8ded3cdc64d 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -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;
OpenPOWER on IntegriCloud