[llvm-branch-commits] [cfe-branch] r142953 - in /cfe/branches/release_30: ./ lib/CodeGen/CGObjCGNU.cpp test/SemaCXX/warn-unreachable.cpp

Bill Wendling isanbard at gmail.com
Tue Oct 25 13:19:33 PDT 2011


Author: void
Date: Tue Oct 25 15:19:33 2011
New Revision: 142953

URL: http://llvm.org/viewvc/llvm-project?rev=142953&view=rev
Log:
Merging r142918:
------------------------------------------------------------------------
r142918 | theraven | 2011-10-25 03:12:21 -0700 (Tue, 25 Oct 2011) | 3 lines

Change an int64_t to an intptr_t so that we don't end up with crashes in the back end on large classes on 32-bit.


------------------------------------------------------------------------

Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp
    cfe/branches/release_30/test/SemaCXX/warn-unreachable.cpp   (props changed)

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 25 15:19:33 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp?rev=142953&r1=142952&r2=142953&view=diff
==============================================================================
--- cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp Tue Oct 25 15:19:33 2011
@@ -1361,8 +1361,8 @@
       LongTy,                 // abi_version
       IvarOffsets->getType(), // ivar_offsets
       Properties->getType(),  // properties
-      Int64Ty,                // strong_pointers
-      Int64Ty,                // weak_pointers
+      IntPtrTy,               // strong_pointers
+      IntPtrTy,               // weak_pointers
       NULL);
   llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0);
   // Fill in the structure
@@ -1723,12 +1723,14 @@
 /// bitfield / with the 63rd bit set will be 1<<64.
 llvm::Constant *CGObjCGNU::MakeBitField(llvm::SmallVectorImpl<bool> &bits) {
   int bitCount = bits.size();
-  if (bitCount < 64) {
+  int ptrBits =
+        (TheModule.getPointerSize() == llvm::Module::Pointer32) ? 32 : 64;
+  if (bitCount < ptrBits) {
     uint64_t val = 1;
     for (int i=0 ; i<bitCount ; ++i) {
       if (bits[i]) val |= 1ULL<<(i+1);
     }
-    return llvm::ConstantInt::get(Int64Ty, val);
+    return llvm::ConstantInt::get(IntPtrTy, val);
   }
   llvm::SmallVector<llvm::Constant*, 8> values;
   int v=0;
@@ -1748,8 +1750,6 @@
   llvm::Constant *GS = MakeGlobal(llvm::StructType::get(Int32Ty, arrayTy,
         NULL), fields);
   llvm::Constant *ptr = llvm::ConstantExpr::getPtrToInt(GS, IntPtrTy);
-  if (IntPtrTy != Int64Ty)
-    ptr = llvm::ConstantExpr::getZExt(ptr, Int64Ty);
   return ptr;
 }
 
@@ -2073,12 +2073,12 @@
       }
       ++ivarIndex;
   }
-  llvm::Constant *Zero64 = llvm::ConstantInt::get(Int64Ty, 0);
+  llvm::Constant *ZeroPtr = llvm::ConstantInt::get(IntPtrTy, 0);
   //Generate metaclass for class methods
   llvm::Constant *MetaClassStruct = GenerateClassStructure(NULLPtr,
       NULLPtr, 0x12L, ClassName.c_str(), 0, Zeros[0], GenerateIvarList(
         empty, empty, empty), ClassMethodList, NULLPtr,
-      NULLPtr, NULLPtr, Zero64, Zero64, true);
+      NULLPtr, NULLPtr, ZeroPtr, ZeroPtr, true);
 
   // Generate the class structure
   llvm::Constant *ClassStruct =

Propchange: cfe/branches/release_30/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 25 15:19:33 2011
@@ -1,2 +1,2 @@
 /cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,142113,142133-142134,142187,142349,142474,142476
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,142113,142133-142134,142187,142349,142474,142476,142918





More information about the llvm-branch-commits mailing list