Added LLVM project notice to the top of every C++ source file.
[oota-llvm.git] / lib / Transforms / Utils / DemoteRegToStack.cpp
index 044cd1610aa3f1c8bdd4da1b551a1053445098f4..a720eb3ebac7edd2ad12528c0f72f66e09a1f6f0 100644 (file)
@@ -1,5 +1,12 @@
 //===- DemoteRegToStack.cpp - Move a virtual reg. to stack ----------------===//
 // 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
+// 
 // This file provide the function DemoteRegToStack().  This function takes a
 // virtual register computed by an Instruction& X and replaces it with a slot in
 // the stack frame, allocated via alloca. It returns the pointer to the
@@ -122,11 +129,8 @@ static void AddLoadsAndStores(AllocaInst* XSlot, Instruction& X,
 }
 
 static void DeletePhis(PhiSet& phisToGo) {
-  for (PhiSetIterator PI=phisToGo.begin(), PE=phisToGo.end(); PI != PE; ++PI) {
-    assert((*PI)->use_size() == 0 && "This PHI should be DEAD!");
-    (*PI)->getParent()->getInstList().remove(*PI);
-    delete *PI;
-  }
+  for (PhiSetIterator PI = phisToGo.begin(), PE =phisToGo.end(); PI != PE; ++PI)
+    (*PI)->getParent()->getInstList().erase(*PI);
   phisToGo.clear();
 }