aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-30 02:13:27 +0000
committerDan Gohman <gohman@apple.com>2009-10-30 02:13:27 +0000
commitab918103d284b91105831c6b198ad2ab760b907d (patch)
treeac7f3b0bd7401226cf9d8d57f8dd3c6fcd62d795 /lib/CodeGen/BranchFolding.cpp
parentdfbbf6e0232315b79805f13baab06828de24e558 (diff)
Don't delete blocks which have their address taken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 9746fb3ea2..455da1ad11 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -881,8 +881,9 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// If this block is empty, make everyone use its fall-through, not the block
// explicitly. Landing pads should not do this since the landing-pad table
- // points to this block.
- if (MBB->empty() && !MBB->isLandingPad()) {
+ // points to this block. Blocks with their addresses taken shouldn't be
+ // optimized away.
+ if (MBB->empty() && !MBB->isLandingPad() && !MBB->hasAddressTaken()) {
// Dead block? Leave for cleanup later.
if (MBB->pred_empty()) return MadeChange;