[llvm-branch-commits] [llvm-branch] r96615 - in /llvm/branches/Apple/Hermes: lib/CodeGen/CodePlacementOpt.cpp test/CodeGen/X86/code_placement_eh.ll

Dan Gohman gohman at apple.com
Thu Feb 18 13:38:44 PST 2010


Author: djg
Date: Thu Feb 18 15:38:43 2010
New Revision: 96615

URL: http://llvm.org/viewvc/llvm-project?rev=96615&view=rev
Log:
--- Merging r96611 into '.':
A    test/CodeGen/X86/code_placement_eh.ll
U    lib/CodeGen/CodePlacementOpt.cpp

Added:
    llvm/branches/Apple/Hermes/test/CodeGen/X86/code_placement_eh.ll
      - copied unchanged from r96611, llvm/trunk/test/CodeGen/X86/code_placement_eh.ll
Modified:
    llvm/branches/Apple/Hermes/lib/CodeGen/CodePlacementOpt.cpp

Modified: llvm/branches/Apple/Hermes/lib/CodeGen/CodePlacementOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/lib/CodeGen/CodePlacementOpt.cpp?rev=96615&r1=96614&r2=96615&view=diff

==============================================================================
--- llvm/branches/Apple/Hermes/lib/CodeGen/CodePlacementOpt.cpp (original)
+++ llvm/branches/Apple/Hermes/lib/CodeGen/CodePlacementOpt.cpp Thu Feb 18 15:38:43 2010
@@ -102,13 +102,6 @@
   // Conservatively ignore EH landing pads.
   if (MBB->isLandingPad()) return false;
 
-  // Ignore blocks which look like they might have EH-related control flow.
-  // At the time of this writing, there are blocks which AnalyzeBranch
-  // thinks end in single uncoditional branches, yet which have two CFG
-  // successors. Code in this file is not prepared to reason about such things.
-  if (!MBB->empty() && MBB->back().isEHLabel())
-    return false;
-
   // Aggressively handle return blocks and similar constructs.
   if (MBB->succ_empty()) return true;
 
@@ -118,6 +111,14 @@
   // Make the the terminator is understood.
   if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond))
     return false;
+   // Ignore blocks which look like they might have EH-related control flow.
+   // AnalyzeBranch thinks it knows how to analyze such things, but it doesn't
+   // recognize the possibility of a control transfer through an unwind.
+   // Such blocks contain EH_LABEL instructions, however they may be in the
+   // middle of the block. Instead of searching for them, just check to see
+   // if the CFG disagrees with AnalyzeBranch.
+  if (1u + !Cond.empty() != MBB->succ_size())
+    return false;
   // Make sure we have the option of reversing the condition.
   if (!Cond.empty() && TII->ReverseBranchCondition(Cond))
     return false;





More information about the llvm-branch-commits mailing list