mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-20 18:56:04 +00:00
getSuccWeight returns now default 0 if Weights vector is empty.
llvm-svn: 133271
This commit is contained in:
parent
ef05689a18
commit
70a2c4bf32
@ -768,6 +768,9 @@ MachineBasicBlock::findDebugLoc(MachineBasicBlock::iterator &MBBI) {
|
||||
/// getSuccWeight - Return weight of the edge from this block to MBB.
|
||||
///
|
||||
uint32_t MachineBasicBlock::getSuccWeight(MachineBasicBlock *succ) {
|
||||
if (Weights.empty())
|
||||
return 0;
|
||||
|
||||
succ_iterator I = std::find(Successors.begin(), Successors.end(), succ);
|
||||
return *getWeightIterator(I);
|
||||
}
|
||||
@ -776,8 +779,7 @@ uint32_t MachineBasicBlock::getSuccWeight(MachineBasicBlock *succ) {
|
||||
/// iterator
|
||||
MachineBasicBlock::weight_iterator MachineBasicBlock::
|
||||
getWeightIterator(MachineBasicBlock::succ_iterator I) {
|
||||
assert((Weights.size() == Successors.size() || Weights.empty()) &&
|
||||
"Async weight list!");
|
||||
assert(Weights.size() == Successors.size() && "Async weight list!");
|
||||
size_t index = std::distance(Successors.begin(), I);
|
||||
assert(index < Weights.size() && "Not a current successor!");
|
||||
return Weights.begin() + index;
|
||||
|
Loading…
x
Reference in New Issue
Block a user