Allow empty Weights vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2011-06-17 17:30:10 +00:00
parent 951cd021c1
commit a6591969ff

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;