use splice instead of remove/insert for a minor speedup
authorChris Lattner <sabre@nondot.org>
Fri, 6 May 2005 19:58:35 +0000 (19:58 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 6 May 2005 19:58:35 +0000 (19:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21743 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index d99680fdb8c4d14846c1fe2471d8dc465737eacd..34e0f70b3c1186865beaef53bc19ece22711731e 100644 (file)
@@ -1703,8 +1703,9 @@ InstructionList : InstructionList Inst {
     // 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($$);
-    CurFun.CurrentFunction->getBasicBlockList().push_back($$);
+    Function::BasicBlockListType &BBL = 
+      CurFun.CurrentFunction->getBasicBlockList();
+    BBL.splice(BBL.end(), BBL, $$);
   }
   | LABELSTR {
     $$ = getBBVal(ValID::create($1), true);
@@ -1712,8 +1713,9 @@ InstructionList : InstructionList Inst {
     // 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($$);
-    CurFun.CurrentFunction->getBasicBlockList().push_back($$);
+    Function::BasicBlockListType &BBL = 
+      CurFun.CurrentFunction->getBasicBlockList();
+    BBL.splice(BBL.end(), BBL, $$);
   };
 
 BBTerminatorInst : RET ResolvedVal {              // Return with a result...