Reserve space for PHI nodes when we read them in. This provides a VERY
authorChris Lattner <sabre@nondot.org>
Thu, 9 Oct 2003 22:46:58 +0000 (22:46 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 9 Oct 2003 22:46:58 +0000 (22:46 +0000)
tasty 15% speedup on the testcase from Bill.

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

lib/Bytecode/Reader/InstructionReader.cpp

index a763d66b227263219b4206a3bd1be3c9dc23cd8a..b415025a578b724ec9aaaeb9e855db62c4ff4384 100644 (file)
@@ -125,6 +125,7 @@ Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf,
       throw std::string("Invalid phi node encountered!\n");
 
     PHINode *PN = new PHINode(InstTy);
+    PN->op_reserve(Args.size());
     for (unsigned i = 0, e = Args.size(); i != e; i += 2)
       PN->addIncoming(getValue(RI.Type, Args[i]), getBasicBlock(Args[i+1]));
     return PN;