llvm::SwitchInst
[oota-llvm.git] / lib / Transforms / Utils / LCSSA.cpp
index ade4a43c6cb8a777373362a2285ccbf019dd138e..b654111eba74e2559a21b1e7900571a91c65ca46 100644 (file)
@@ -222,9 +222,10 @@ bool LCSSA::ProcessInstruction(Instruction *Inst,
     // If we already inserted something for this BB, don't reprocess it.
     if (SSAUpdate.HasValueForBlock(ExitBB)) continue;
     
-    PHINode *PN = PHINode::Create(Inst->getType(), Inst->getName()+".lcssa",
+    PHINode *PN = PHINode::Create(Inst->getType(),
+                                  PredCache.GetNumPreds(ExitBB),
+                                  Inst->getName()+".lcssa",
                                   ExitBB->begin());
-    PN->reserveOperandSpace(PredCache.GetNumPreds(ExitBB));
 
     // Add inputs from inside the loop for this PHI.
     for (BasicBlock **PI = PredCache.GetPreds(ExitBB); *PI; ++PI) {
@@ -269,7 +270,7 @@ bool LCSSA::ProcessInstruction(Instruction *Inst,
 
   // Remove PHI nodes that did not have any uses rewritten.
   for (unsigned i = 0, e = AddedPHIs.size(); i != e; ++i) {
-    if (!AddedPHIs[i]->hasNUsesOrMore(1))
+    if (AddedPHIs[i]->use_empty())
       AddedPHIs[i]->eraseFromParent();
   }