<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Right, I filed the VS2012 bug with MS and they've fixed it with SP 2.  Verified locally building LLVM + Clang 3.2, all available tools built without errors. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> I never saw it in VS2010, but the last time I built with that would have been with the LLVM 3.0 codeline, I believe.   Honestly a cleaner option than inserting the noinline is to modify the CMakeFiles for the specific directory / file where this happens to force /Ob0 when the broken version of the MS compiler is in use.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I don't think GCC will like a blind insertion of __declspec(noinline) but I could be wrong.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>-Gordon<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu] <b>On Behalf Of </b>Kuperstein, Michael M<br><b>Sent:</b> Thursday, April 18, 2013 4:56 AM<br><b>To:</b> Sergiy Migdalskiy; David Blaikie<br><b>Cc:</b> llvmdev@cs.uiuc.edu<br><b>Subject:</b> Re: [LLVMdev] Patch to compile LLVM with MSVC 2010<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The original thread on this ICE, including a link to the bug submitted to MS is here:<o:p></o:p></span></p><p class=MsoNormal><a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056683.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056683.html</a><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Michael<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [<a href="mailto:llvmdev-bounces@cs.uiuc.edu">mailto:llvmdev-bounces@cs.uiuc.edu</a>] <b>On Behalf Of </b>Sergiy Migdalskiy<br><b>Sent:</b> Thursday, April 18, 2013 10:28<br><b>To:</b> David Blaikie<br><b>Cc:</b> <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br><b>Subject:</b> Re: [LLVMdev] Patch to compile LLVM with MSVC 2010<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>From the <a href="http://llvm.org/docs/DeveloperPolicy.html" target="_blank"><span style='font-size:11.5pt;color:#0068CF'>DeveloperPolicy.html</span></a> document I gathered I need to send a patch to this list (which I did); could you clarify if I misunderstood it?<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>The second patch is really trivial and I think it's worth applying - it seems like a typo by someone who tested on MSVC 11 but not 10; or maybe my local instance of MSVC10 is somehow deficient, of course.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>The first patch is adding MSVC-specific __declspec(noinline) - that's the whole patch - so if someone experienced who has access to all the platforms LLVM compiles on could test it (and/or replace it with something cross-platform; or #ifdef it out everywhere non-MS), I think that would be worth applying to the trunk. I don't have those resources.<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>The cause of ICE is pretty much right here - inlining utostr crashes MSVC cl.exe. I read about it a few months ago elsewhere and I think the bug was filed with MS (I'm not positive and I have no idea how/where to check it). I don't think I can find much more precise cause within reasonable time, ICE doesn't reproduce in simple cases and I'm not committed enough to do a lengthy binary search of the combination of factors that causes this particular ICE when I only have a lukewarm hope MS would ever give this bug a look. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Either way, I thought I'd try to push this through. It's not high-value enough to try harder, but it'd be great if someone could help me submit it - it's a <i>really </i>simple couple of patches that make LLVM/clang compile on MSVC10 without further modifications.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Regards,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>Sergiy<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='font-family:"Calibri","sans-serif"'>> Date: Wed, 17 Apr 2013 21:56:43 -0700<br>> Subject: Re: [LLVMdev] Patch to compile LLVM with MSVC 2010<br>> From: <a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a><br>> To: <a href="mailto:migdalskiy@hotmail.com">migdalskiy@hotmail.com</a><br>> CC: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>> <br>> On Wed, Apr 17, 2013 at 11:36 AM, Sergiy Migdalskiy<br>> <<a href="mailto:migdalskiy@hotmail.com">migdalskiy@hotmail.com</a>> wrote:<br>> > In order to get llvm to compile on Windows with MSVC 10, I have to disable<br>> > inline on utostr to avoid internal compiler failure, and disable _xgetbv<br>> > call in OsSupportsAVX because it's only defined in MSVC 2012 compiler. The<br>> > first patch (noinline) is known for many months now. I'm a casual llvm user,<br>> > and don't know the proper channels to go through to submit a patch. Could<br>> > someone tell me, where do I submit patches like this one below?<br>> <br>> <a href="http://llvm.org/docs/DeveloperPolicy.html">http://llvm.org/docs/DeveloperPolicy.html</a><br>> <br>> > Or maybe why<br>> > I shouldn't try to do it.<br>> <br>> We're generally happy to apply patches to ensure LLVM compiles on<br>> relevant compilers. For ICEs it might help to know what the precise<br>> problem is & to have a bug filed on the compiler.<br>> <br>> ><br>> > Sincerely,<br>> > Sergiy<br>> ><br>> > Index: include/llvm/ADT/StringExtras.h<br>> > ===================================================================<br>> > --- include/llvm/ADT/StringExtras.h (revision 179701)<br>> > +++ include/llvm/ADT/StringExtras.h (working copy)<br>> > @@ -84,7 +84,7 @@<br>> > return std::string(BufPtr, Buffer+11);<br>> > }<br>> ><br>> > -static inline std::string utostr(uint64_t X, bool isNeg = false) {<br>> > +static __declspec(noinline) inline std::string utostr(uint64_t X, bool<br>> > isNeg = false) {<br>> > char Buffer[21];<br>> > char *BufPtr = Buffer+21;<br>> ><br>> > Index: lib/Support/Host.cpp<br>> > ===================================================================<br>> > --- lib/Support/Host.cpp (revision 179701)<br>> > +++ lib/Support/Host.cpp (working copy)<br>> > @@ -119,7 +119,7 @@<br>> > // there is no easy way to conditionally compile based on the assembler<br>> > used.<br>> > int rEAX, rEDX;<br>> > __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));<br>> > -#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219<br>> > +#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER > 160040219<br>> > unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);<br>> > #else<br>> > int rEAX = 0; // Ensures we return false<br>> ><br>> ><br>> > _______________________________________________<br>> > LLVM Developers mailing list<br>> > <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>> ><o:p></o:p></span></p></div></div></div></div></div><p>---------------------------------------------------------------------<br>Intel Israel (74) Limited<o:p></o:p></p><p>This e-mail and any attachments may contain confidential material for<br>the sole use of the intended recipient(s). Any review or distribution<br>by others is strictly prohibited. If you are not the intended<br>recipient, please contact the sender and delete all copies.<o:p></o:p></p></div></div></body></html>