summaryrefslogtreecommitdiff
path: root/include
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
commitf90fb345db46faf25240e066f41025e009b09768 (patch)
treed870749871ddf5664479760be9714390827dcf11 /include
parente08eb9ca1dc832e0c8b460459fe218622f231898 (diff)
downloadllvm-f90fb345db46faf25240e066f41025e009b09768.tar.gz
llvm-f90fb345db46faf25240e066f41025e009b09768.tar.bz2
llvm-f90fb345db46faf25240e066f41025e009b09768.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/ScheduleDAGInstrs.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAGInstrs.h b/include/llvm/CodeGen/ScheduleDAGInstrs.h
index 2e5d833635..7c0e80afe4 100644
--- a/include/llvm/CodeGen/ScheduleDAGInstrs.h
+++ b/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();
}