[llvm-commits] [llvm] r52495 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp

Dan Gohman gohman at apple.com
Thu Jun 19 10:22:30 PDT 2008


Author: djg
Date: Thu Jun 19 12:22:29 2008
New Revision: 52495

URL: http://llvm.org/viewvc/llvm-project?rev=52495&view=rev
Log:
Use the transferSuccessors helper function.

Modified:
    llvm/trunk/lib/CodeGen/BranchFolding.cpp

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=52495&r1=52494&r2=52495&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Thu Jun 19 12:22:29 2008
@@ -381,11 +381,7 @@
   CurMBB.getParent()->getBasicBlockList().insert(++MBBI, NewMBB);
 
   // Move all the successors of this block to the specified block.
-  while (!CurMBB.succ_empty()) {
-    MachineBasicBlock *S = *(CurMBB.succ_end()-1);
-    NewMBB->addSuccessor(S);
-    CurMBB.removeSuccessor(S);
-  }
+  NewMBB->transferSuccessors(&CurMBB);
  
   // Add an edge from CurMBB to NewMBB for the fall-through.
   CurMBB.addSuccessor(NewMBB);





More information about the llvm-commits mailing list