[llvm-commits] [llvm] r62576 - /llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
Duncan Sands
baldrick at free.fr
Tue Jan 20 01:05:20 PST 2009
Author: baldrick
Date: Tue Jan 20 03:05:19 2009
New Revision: 62576
URL: http://llvm.org/viewvc/llvm-project?rev=62576&view=rev
Log:
If a vector is empty, you're not allowed to access any
elements, even if it is only to take the address. Test:
break-anti-dependencies.ll with ENABLE_EXPENSIVE_CHECKS.
Modified:
llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h?rev=62576&r1=62575&r2=62576&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h Tue Jan 20 03:05:19 2009
@@ -49,10 +49,11 @@
///
SUnit *NewSUnit(MachineInstr *MI) {
#ifndef NDEBUG
- const SUnit *Addr = &SUnits[0];
+ const SUnit *Addr = SUnits.empty() ? 0 : &SUnits[0];
#endif
SUnits.push_back(SUnit(MI, (unsigned)SUnits.size()));
- assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!");
+ assert((Addr == 0 || Addr == &SUnits[0]) &&
+ "SUnits std::vector reallocated on the fly!");
SUnits.back().OrigNode = &SUnits.back();
return &SUnits.back();
}
More information about the llvm-commits
mailing list