[LLVMdev] VS2005 patches

Morten Ofstad morten at hue.no
Thu Jan 26 07:11:20 PST 2006


In the VS2005 debug std libraries, the lower_bound algorithm uses a
function known as _DEBUG_LT. The problem with this is that it asserts
that if a < b then !(b < a). It also asserts that the input is actually
sorted by using < to compare the elements.

In LLVM there are a couple of places where the lower_bound algorithm is
used with a lower bound of a different type than the iterators. It seems
to me upon checking the relevant parts of the ISO C++ standard (25.3 Sorting
and related operations) that MS are within their rights to make these
requirements on the < operator, although it's pretty annoying.

There are three possible solutions (in order of preference):

1) when the problem occurs because implicit conversion fails when the
     operator< is a class member and you switch the arguments, make an
     explicit conversion of the lower bound value.
2) to provide another operator< that provides the necessary comparision
     for _DEBUG_LT to work
3) change code that looks for a lower bound of a different type to look
     for a lower bound of the same type as the iterators

I used 1) in CorrelatedExprs
I used 2) in LiveInterval, X86FloatingPoint
I used 3) in SubTargetFeature

-

In addition to this, I include a patch to the X86JITInfo so it will compile with the X64 platform and patches to the
current project files to build the X86GenSubTarget.inc file with TableGen.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: JIT.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060126/b752fdc3/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bounds.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060126/b752fdc3/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vcproj.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060126/b752fdc3/attachment-0002.ksh>


More information about the llvm-dev mailing list