Patch to compile LLVM with MSVC 2010

In order to get llvm to compile on Windows with MSVC 10, I have to disable inline on utostr to avoid internal compiler failure, and disable _xgetbv call in OsSupportsAVX because it’s only defined in MSVC 2012 compiler. The first patch (noinline) is known for many months now. I’m a casual llvm user, and don’t know the proper channels to go through to submit a patch. Could someone tell me, where do I submit patches like this one below? Or maybe why I shouldn’t try to do it.

Sincerely,
Sergiy

Index: include/llvm/ADT/StringExtras.h

In order to get llvm to compile on Windows with MSVC 10, I have to disable
inline on utostr to avoid internal compiler failure, and disable _xgetbv
call in OsSupportsAVX because it's only defined in MSVC 2012 compiler. The
first patch (noinline) is known for many months now. I'm a casual llvm user,
and don't know the proper channels to go through to submit a patch. Could
someone tell me, where do I submit patches like this one below?

http://llvm.org/docs/DeveloperPolicy.html

Or maybe why
I shouldn't try to do it.

We're generally happy to apply patches to ensure LLVM compiles on
relevant compilers. For ICEs it might help to know what the precise
problem is & to have a bug filed on the compiler.

From the DeveloperPolicy.html document I gathered I need to send a patch to this list (which I did); could you clarify if I misunderstood it?

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.

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.

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.

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 really simple couple of patches that make LLVM/clang compile on MSVC10 without further modifications.

Regards,
Sergiy

The original thread on this ICE, including a link to the bug submitted to MS is here:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056683.html

Michael

The _xgetbv requires Visual Studio 2010 SP1 or greater, not VS 2012.

http://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions

MSDN's documentation wasn't updated until 2012 though, so it's a bit confusing.

That being said, it should still compile in a non-SP1 VS 2010, but I
believe the original code does that because 160040219 is the
identifier for 2010 SP1

~Aaron

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.

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.

I don’t think GCC will like a blind insertion of __declspec(noinline) but I could be wrong.

-Gordon