Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

llvm-svn: 128537
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index 5e21a21..1f13c55 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1195,8 +1195,8 @@
 
     PHINode *NewPN =
      PHINode::Create(PointerType::getUnqual(ST->getElementType(FieldNo)),
+                     PN->getNumIncomingValues(),
                      PN->getName()+".f"+Twine(FieldNo), PN);
-    NewPN->reserveOperandSpace(PN->getNumIncomingValues());
     Result = NewPN;
     PHIsToRewrite.push_back(std::make_pair(PN, FieldNo));
   } else {
diff --git a/llvm/lib/Transforms/IPO/LowerSetJmp.cpp b/llvm/lib/Transforms/IPO/LowerSetJmp.cpp
index cb3875e..52ecf17 100644
--- a/llvm/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/llvm/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -430,9 +430,8 @@
 
   // This PHI node will be in the new block created from the
   // splitBasicBlock call.
-  PHINode* PHI = PHINode::Create(Type::getInt32Ty(Inst->getContext()),
+  PHINode* PHI = PHINode::Create(Type::getInt32Ty(Inst->getContext()), 2,
                                  "SetJmpReturn", Inst);
-  PHI->reserveOperandSpace(2);
 
   // Coming from a call to setjmp, the return is 0.
   PHI->addIncoming(Constant::getNullValue(Type::getInt32Ty(Inst->getContext())),
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp
index 7fa0de1..d9d1d10 100644
--- a/llvm/lib/Transforms/IPO/PartialInlining.cpp
+++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp
@@ -95,8 +95,7 @@
     PHINode* OldPhi = dyn_cast<PHINode>(I);
     if (!OldPhi) break;
     
-    PHINode* retPhi = PHINode::Create(OldPhi->getType(), "", Ins);
-    retPhi->reserveOperandSpace(2);
+    PHINode* retPhi = PHINode::Create(OldPhi->getType(), 2, "", Ins);
     OldPhi->replaceAllUsesWith(retPhi);
     Ins = newReturnBlock->getFirstNonPHI();