Don't forget to transfer implicit uses of return instruction.
[oota-llvm.git] / lib / Transforms / Utils / UnifyFunctionExitNodes.cpp
index 24d20d0e84d34c786d7f69b232fa061686fa4fba..46d4adaaa1542a11479cfc852fecd4e40770c570 100644 (file)
@@ -116,8 +116,8 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
     ReturnInst::Create(F.getContext(), NULL, NewRetBlock);
   } else {
     // If the function doesn't return void... add a PHI node to the block...
-    PN = PHINode::Create(F.getReturnType(), "UnifiedRetVal");
-    PN->reserveOperandSpace(ReturningBlocks.size());
+    PN = PHINode::Create(F.getReturnType(), ReturningBlocks.size(),
+                         "UnifiedRetVal");
     NewRetBlock->getInstList().push_back(PN);
     ReturnInst::Create(F.getContext(), PN, NewRetBlock);
   }