]> granicus.if.org Git - clang/commitdiff
(Almost) always call reserveOperandSpace() on newly created PHINodes.
authorJay Foad <jay.foad@gmail.com>
Wed, 30 Mar 2011 11:19:06 +0000 (11:19 +0000)
committerJay Foad <jay.foad@gmail.com>
Wed, 30 Mar 2011 11:19:06 +0000 (11:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128534 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CGObjCGNU.cpp

index e6b6ee92c03f67ea89d8248fc8122c90f78bb0b1..c998372d9941fc78a5c75751dbc2d6e0145c034e 100644 (file)
@@ -475,6 +475,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
     PHINode *Result =
       Builder.CreatePHI(ConvertType(E->getArg(0)->getType()),
                         "fpclassify_result");
+    Result->reserveOperandSpace(4);
 
     // if (V==0) return FP_ZERO
     Builder.SetInsertPoint(Begin);
index dcdd81d1f84a39a9685063f19a909bb9616ad240..386fd95593eeb767dcc5ea16b1da4bcf0149aad0 100644 (file)
@@ -831,10 +831,12 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
 
   // The current index into the buffer.
   llvm::PHINode *index = Builder.CreatePHI(UnsignedLongLTy, "forcoll.index");
+  index->reserveOperandSpace(3);
   index->addIncoming(zero, LoopInitBB);
 
   // The current buffer size.
   llvm::PHINode *count = Builder.CreatePHI(UnsignedLongLTy, "forcoll.count");
+  count->reserveOperandSpace(3);
   count->addIncoming(initialBufferLimit, LoopInitBB);
 
   // Check whether the mutations value has changed from where it was
index bea6f3a94c196c1fdf4cba0da9ac478dd8a4ac8c..8611c5f9104c526ccff71be1ac9893eb61a6ba16 100644 (file)
@@ -1145,6 +1145,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
     if (msgRet.isScalar()) {
       llvm::Value *v = msgRet.getScalarVal();
       llvm::PHINode *phi = Builder.CreatePHI(v->getType());
+      phi->reserveOperandSpace(2);
       phi->addIncoming(v, messageBB);
       phi->addIncoming(llvm::Constant::getNullValue(v->getType()), startBB);
       msgRet = RValue::get(phi);
@@ -1156,16 +1157,19 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
           CGF.CreateTempAlloca(RetTy->getElementType(), "null");
       CGF.InitTempAlloca(NullVal,
           llvm::Constant::getNullValue(RetTy->getElementType()));
+      phi->reserveOperandSpace(2);
       phi->addIncoming(v, messageBB);
       phi->addIncoming(NullVal, startBB);
       msgRet = RValue::getAggregate(phi);
     } else /* isComplex() */ {
       std::pair<llvm::Value*,llvm::Value*> v = msgRet.getComplexVal();
       llvm::PHINode *phi = Builder.CreatePHI(v.first->getType());
+      phi->reserveOperandSpace(2);
       phi->addIncoming(v.first, messageBB);
       phi->addIncoming(llvm::Constant::getNullValue(v.first->getType()),
           startBB);
       llvm::PHINode *phi2 = Builder.CreatePHI(v.second->getType());
+      phi2->reserveOperandSpace(2);
       phi2->addIncoming(v.second, messageBB);
       phi2->addIncoming(llvm::Constant::getNullValue(v.second->getType()),
           startBB);