Bugfixes
authorChris Lattner <sabre@nondot.org>
Tue, 3 Oct 2006 20:19:23 +0000 (20:19 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 3 Oct 2006 20:19:23 +0000 (20:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30709 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineFunction.cpp

index 21f41b95b00cb20f9091da95dd698ada2fe0d3d7..205414e7264cc3c4b0d0b7b614a547e2be40efa3 100644 (file)
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
-#include "llvm/Support/LeakDetector.h"
-#include "llvm/Support/GraphWriter.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/GraphWriter.h"
+#include "llvm/Support/LeakDetector.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/config.h"
 #include <fstream>
 #include <iostream>
@@ -148,11 +149,8 @@ void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) {
   
   // Figure out the block number this should have.
   unsigned BlockNo = 0;
-  if (MBB != &front()) {
-    MachineFunction::iterator I = MBB;
-    --I;
-    BlockNo = I->getNumber()+1;
-  }
+  if (MBBI != begin())
+    BlockNo = prior(MBBI)->getNumber()+1;
   
   for (; MBBI != E; ++MBBI, ++BlockNo) {
     if (MBBI->getNumber() != (int)BlockNo) {