Fix an extremely serious regression that was causing LLVM basic blocks to be
authorChris Lattner <sabre@nondot.org>
Mon, 26 Jul 2004 01:22:59 +0000 (01:22 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 26 Jul 2004 01:22:59 +0000 (01:22 +0000)
scrambled around almost at random, having really bad effects on icache locality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index d7c1723b69f5b8ed358ddf2c8990629266a1f91a..440056de2dfd02a86544e4fbc2dd0acffb778932 100644 (file)
@@ -383,6 +383,12 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
       ThrowException("Redefinition of label " + ID.getName());
 
     ID.destroy();                       // Free strdup'd memory.
+
+    // Make sure to move the basic block to the correct location in the
+    // function, instead of leaving it inserted wherever it was first
+    // referenced.
+    CurFun.CurrentFunction->getBasicBlockList().remove(BB);
+    CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
     return BB;
   }