[llvm-commits] [llvm] r127245 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Mar 8 11:30:34 PST 2011


On Mar 8, 2011, at 11:25 AM, Óscar Fuentes wrote:

> Jakob Stoklund Olesen <stoklund at 2pi.dk> writes:
> 
>>> Author: ofv
>>> Date: Tue Mar  8 07:52:07 2011
>>> New Revision: 127245
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=127245&view=rev
>>> Log:
>>> Make a comparator's argument `const'. This fixes the build for MSVC 9.
>>> 
>>> Modified:
>>>   llvm/trunk/lib/CodeGen/LiveInterval.cpp
>>> 
>>> Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=127245&r1=127244&r2=127245&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Mar  8 07:52:07 2011
>>> @@ -36,7 +36,7 @@
>>>  bool operator()(SlotIndex A, const LiveRange &B) const {
>>>    return A < B.end;
>>>  }
>>> -  bool operator()(const LiveRange &A, SlotIndex B) const {
>>> +  bool operator()(const LiveRange &A, const SlotIndex B) const {
>>>    return A.end < B;
>>>  }
>>> };
>> 
>> Huh? A const by-value argument looks like a bug to me. What was the error?
> 
> Ugh! You are right, of course. Mistakes like this happen when you work
> with an attention-demanding 2 year old jumping around. I'll revert the
> change ASAP.
> 
> Do you think that the patch posted by the bug reporter is correct?

I've had trouble with using different types to upper_bound and MSVC before. I thought it would be enough to provide the two natural permutations, but if it is actually comparing elements in the array (which is guaranteed to be sorted!), the extra method is needed.

I'll apply the patch once you've reverted yours.

Thanks,
/jakob





More information about the llvm-commits mailing list