Allow empty Weights vector.

llvm-svn: 133265
This commit is contained in:
Jakub Staszak 2011-06-17 17:30:10 +00:00
parent c30661f3a8
commit 2ce8399a2d
1 changed files with 2 additions and 1 deletions

View File

@ -776,7 +776,8 @@ uint32_t MachineBasicBlock::getSuccWeight(MachineBasicBlock *succ) {
/// iterator
MachineBasicBlock::weight_iterator MachineBasicBlock::
getWeightIterator(MachineBasicBlock::succ_iterator I) {
assert(Weights.size() == Successors.size() && "Async weight list!");
assert((Weights.size() == Successors.size() || Weights.empty()) &&
"Async weight list!");
size_t index = std::distance(Successors.begin(), I);
assert(index < Weights.size() && "Not a current successor!");
return Weights.begin() + index;