Add an assertion to the ScheduleDAGInstrs class to catch SUnits

reallocations. We don't do cloning on MachineInstr schedule DAGs,
but this is a worthwhile sanity check regardless.

llvm-svn: 61343
This commit is contained in:
Dan Gohman 2008-12-22 21:08:08 +00:00
parent fd87a5088e
commit a6fbc282b2
1 changed files with 4 additions and 0 deletions

View File

@ -36,7 +36,11 @@ namespace llvm {
/// NewSUnit - Creates a new SUnit and return a ptr to it.
///
SUnit *NewSUnit(MachineInstr *MI) {
#ifndef NDEBUG
const SUnit *Addr = &SUnits[0];
#endif
SUnits.push_back(SUnit(MI, (unsigned)SUnits.size()));
assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!");
SUnits.back().OrigNode = &SUnits.back();
return &SUnits.back();
}