[llvm-commits] [llvm] r133265 - /llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Jakub Staszak jstaszak at apple.com
Fri Jun 17 15:37:07 PDT 2011


Yeah,

it would, I already changed it back and added if(Weight.empty()) condition in getSuccWeight.

-Kuba

On Jun 17, 2011, at 3:32 PM, Jakob Stoklund Olesen wrote:

> 
> On Jun 17, 2011, at 10:30 AM, Jakub Staszak wrote:
> 
>> Author: kuba
>> Date: Fri Jun 17 12:30:10 2011
>> New Revision: 133265
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=133265&view=rev
>> Log:
>> Allow empty Weights vector.
>> 
>> Modified:
>>   llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
>> 
>> Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=133265&r1=133264&r2=133265&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Fri Jun 17 12:30:10 2011
>> @@ -776,7 +776,8 @@
>> /// 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;
> 
> Won't the next assert fire anyway if the vector is empty? And rightly so.
> 
> /jakob
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110617/77964263/attachment.html>


More information about the llvm-commits mailing list