summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-01-20 09:05:19 +0000
committerDuncan Sands <baldrick@free.fr>2009-01-20 09:05:19 +0000
commitcd3fbfb46029294792ea89dfca79c714d02044a3 (patch)
treec2a2b8ce5ed95b01006133331ef5c9869111db99
parent08c5dabf1b172f5f57c014befadd55180b2f734b (diff)
downloadbcm5719-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.h5
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();
}
OpenPOWER on IntegriCloud