aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index c69930da81..8ded3cdc64 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/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;