[llvm-commits] [llvm-gcc-4.2] r47559 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Dale Johannesen dalej at apple.com
Mon Feb 25 12:57:39 PST 2008


Author: johannes
Date: Mon Feb 25 14:57:39 2008
New Revision: 47559

URL: http://llvm.org/viewvc/llvm-project?rev=47559&view=rev
Log:
Do not pass union with a single long double
as a scalar long double; not the same.


Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=47559&r1=47558&r2=47559&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Feb 25 14:57:39 2008
@@ -701,7 +701,7 @@
   HOST_WIDE_INT SrcSize = int_size_in_bytes(TreeType);
   if (SrcSize <= 0 || SrcSize > 16)
     return false;
-  
+
   // X86-32 passes aggregates on the stack.  If this is an extremely simple
   // aggregate whose elements would be passed the same if passed as scalars,
   // pass them that way in order to promote SROA on the caller and callee side.
@@ -710,13 +710,16 @@
   // would be passed as stand-alone arguments.
   const StructType *STy = dyn_cast<StructType>(Ty);
   if (!STy || STy->isPacked()) return false;
-  
+
   for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
     const Type *EltTy = STy->getElementType(i);
-    // 32 and 64-bit integers are fine, as are float, double, and long double.
+    // 32 and 64-bit integers are fine, as are float and double.  Long double
+    // (which can be picked as the type for a union of 16 bytes) is not fine, 
+    // as loads and stores of it get only 10 bytes.
     if (EltTy == Type::Int32Ty ||
         EltTy == Type::Int64Ty || 
-        EltTy->isFloatingPoint() ||
+        EltTy == Type::FloatTy ||
+        EltTy == Type::DoubleTy ||
         isa<PointerType>(EltTy)) {
       Elts.push_back(EltTy);
       continue;





More information about the llvm-commits mailing list