[LLVMdev] Visual Studio 2012 cl.exe ICE while building LLVM for x64 (in TableGen) at -O2

NAKAMURA Takumi geek4civic at gmail.com
Thu Dec 6 23:21:44 PST 2012


I have reproduced one also on VS10 x64|RelWithDebInfo.

I suggest simply tweak usage.

--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -379,7 +379,8 @@ static bool isObjectStart(tgtok::TokKind K) {

 static std::string GetNewAnonymousName() {
   static unsigned AnonCounter = 0;
-  return "anonymous."+utostr(AnonCounter++);
+  unsigned n = AnonCounter++;
+  return "anonymous."+utostr(n);
 }

 /// ParseObjectName - If an object name is specified, return it.  Otherwise,
diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp
b/llvm/utils/TableGen/CodeGenRegisters.cpp
index 20d439f..20933bf 100644
--- a/llvm/utils/TableGen/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -701,7 +701,8 @@
CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank,
Record *R)
   // Rename anonymous register classes.
   if (R->getName().size() > 9 && R->getName()[9] == '.') {
     static unsigned AnonCounter = 0;
-    R->setName("AnonRegClass_"+utostr(AnonCounter++));
+    R->setName("AnonRegClass_"+utostr(AnonCounter));
+    ++AnonCounter;
   }

   std::vector<Record*> TypeList = R->getValueAsListOfDefs("RegTypes");

FYI, utosotr(++AnonCounter) could be accepted if 0-origination were
not important.

...Takumi

2012/12/5 Gordon Keiser <gkeiser at arxan.com>:
>> On Behalf Of Nicholas Chapman
>>
>> On 04/12/2012 06:29, Michael Spencer wrote:
>> > On Mon, Dec 3, 2012 at 8:08 PM, Gordon Keiser <gkeiser at arxan.com>
>> wrote:
>> >> As an update to this:
>> >> http://connect.microsoft.com/VisualStudio/feedback/details/769222/cl-
>> >> exe-ice-when-building-llvm-trunk-at-o2
>> >>
>> >> Microsoft has reproduced the ICE, given a workaround, and is planning a
>> fix for a future MSVC release.   I know not a lot of people are building with
>> VS, but it's nice to know.  The workaround involves marking a single function
>> with attribute((noinline)) and is detailed on the page,  so nothing too horrible
>> there.
>> > I'm guessing this was specific to the arm backend. As quite a few
>> > people are building with MSVC daily.
>> >
>> >
>> No, it happens targeting x64, and maybe x86 as well.
>>
>>      Nick C.
>
> Right, it's specific to Visual Studio 2012, the crash happens in two tablegen files when inlining utostr.   I've not run into it building with 2010 or 2008.   It's rather odd that utostr_32 doesn't cause the same issue since they share nearly identical code.
>
> Gordon Keiser
> Software Development Engineer
> Arxan Technologies
> Protecting the App EconomyT
>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list