aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/ScheduleDAGSDNodes.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAGSDNodes.h b/include/llvm/CodeGen/ScheduleDAGSDNodes.h
index d7f0ea49d4..b9c6428fba 100644
--- a/include/llvm/CodeGen/ScheduleDAGSDNodes.h
+++ b/include/llvm/CodeGen/ScheduleDAGSDNodes.h
@@ -103,10 +103,13 @@ namespace llvm {
///
SUnit *NewSUnit(SDNode *N) {
#ifndef NDEBUG
- const SUnit *Addr = &SUnits[0];
+ const SUnit *Addr = 0;
+ if (SUnits.size() > 0)
+ Addr = &SUnits[0];
#endif
SUnits.push_back(SUnit(N, (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();
}