//===- 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
}
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();
}