diff options
author | Duncan Sands <baldrick@free.fr> | 2009-01-20 09:05:19 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-01-20 09:05:19 +0000 |
commit | cd3fbfb46029294792ea89dfca79c714d02044a3 (patch) | |
tree | c2a2b8ce5ed95b01006133331ef5c9869111db99 | |
parent | 08c5dabf1b172f5f57c014befadd55180b2f734b (diff) | |
download | bcm5719-llvm-cd3fbfb46029294792ea89dfca79c714d02044a3.tar.gz bcm5719-llvm-cd3fbfb46029294792ea89dfca79c714d02044a3.zip |
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.
llvm-svn: 62576
-rw-r--r-- | llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h b/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h index 2e5d8336352..7c0e80afe43 100644 --- a/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h +++ b/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h @@ -49,10 +49,11 @@ namespace llvm { /// 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(); } |