OSDN Git Service

Don't delete blocks which have their address taken.
authorDan Gohman <gohman@apple.com>
Fri, 30 Oct 2009 02:13:27 +0000 (02:13 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 30 Oct 2009 02:13:27 +0000 (02:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85572 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BranchFolding.cpp

index 9746fb3..455da1a 100644 (file)
@@ -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;