forked from OSchip/llvm-project
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
This commit is contained in:
parent
08c5dabf1b
commit
cd3fbfb460
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue