[llvm-branch-commits] [llvm-branch] r91102 - in /llvm/branches/Apple/Zoidberg: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp

Bill Wendling isanbard at gmail.com
Thu Dec 10 19:16:33 PST 2009


Author: void
Date: Thu Dec 10 21:16:33 2009
New Revision: 91102

URL: http://llvm.org/viewvc/llvm-project?rev=91102&view=rev
Log:
$ svn merge -c 91101 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r91101 into '.':
U    include/llvm/CodeGen/MachineBasicBlock.h
U    lib/CodeGen/MachineBasicBlock.cpp


Modified:
    llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineBasicBlock.h
    llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineBasicBlock.h?rev=91102&r1=91101&r2=91102&view=diff

==============================================================================
--- llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineBasicBlock.h Thu Dec 10 21:16:33 2009
@@ -327,9 +327,9 @@
   /// 'Old', change the code and CFG so that it branches to 'New' instead.
   void ReplaceUsesOfBlockWith(MachineBasicBlock *Old, MachineBasicBlock *New);
 
-  /// BranchesToLandingPad - The basic block branches only to a landing pad or
-  /// to another basic block which branches only to a landing pad. No other
-  /// instructions are present other than the unconditional branch.
+  /// BranchesToLandingPad - The basic block is a landing pad or branches only
+  /// to a landing pad. No other instructions are present other than the
+  /// unconditional branch.
   bool BranchesToLandingPad(const MachineBasicBlock *MBB) const;
 
   /// CorrectExtraCFGEdges - Various pieces of code can cause excess edges in

Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp?rev=91102&r1=91101&r2=91102&view=diff

==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp Thu Dec 10 21:16:33 2009
@@ -449,24 +449,19 @@
   addSuccessor(New);
 }
 
-/// BranchesToLandingPad - The basic block branches only to a landing pad or to
-/// another basic block which branches only to a landing pad. No other
-/// instructions are present other than the unconditional branch.
+/// BranchesToLandingPad - The basic block is a landing pad or branches only to
+/// a landing pad. No other instructions are present other than the
+/// unconditional branch.
 bool
 MachineBasicBlock::BranchesToLandingPad(const MachineBasicBlock *MBB) const {
   SmallSet<const MachineBasicBlock*, 32> Visited;
   const MachineBasicBlock *CurMBB = MBB;
 
-  while (!Visited.count(CurMBB) && !CurMBB->isLandingPad()) {
-    if (CurMBB->size() != 1 || CurMBB->succ_empty() || CurMBB->succ_size() != 1)
+  while (!CurMBB->isLandingPad()) {
+    if (CurMBB->succ_size() != 1)
       break;
 
-    const TargetInstrInfo *TII =
-      CurMBB->getParent()->getTarget().getInstrInfo();
-    if (!TII->isUnpredicatedTerminator(CurMBB->begin()))
-      break;
-
-    Visited.insert(CurMBB);
+    if (!Visited.insert(CurMBB)) break;
     CurMBB = *CurMBB->succ_begin();
   }
 
@@ -515,8 +510,8 @@
     } else if (MBB == DestB) {
       DestB = 0;
       ++SI;
-    } else if (BranchesToLandingPad(MBB) &&
-               MBB != OrigDestA && MBB != OrigDestB) {
+    } else if (MBB != OrigDestA && MBB != OrigDestB &&
+               BranchesToLandingPad(MBB)) {
       ++SI;
     } else {
       // Otherwise, this is a superfluous edge, remove it.





More information about the llvm-branch-commits mailing list