[llvm-branch-commits] [cfe-branch] r71619 - in /cfe/branches/Apple/Dib: lib/CodeGen/CGCall.cpp test/CodeGen/x86_32-arguments.c

Mike Stump mrs at apple.com
Tue May 12 19:58:56 PDT 2009


Author: mrs
Date: Tue May 12 21:58:55 2009
New Revision: 71619

URL: http://llvm.org/viewvc/llvm-project?rev=71619&view=rev
Log:
Merge in 71559:

Darwin x86-32 ABI: Now that structure passing is farther along, we
don't need special treatment for unions.

Modified:
    cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp
    cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c

Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp?rev=71619&r1=71618&r2=71619&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp Tue May 12 21:58:55 2009
@@ -446,18 +446,11 @@
       }
     }
 
-    uint64_t Size = Context.getTypeSize(RetTy);
-    if (isRegisterSize(Size)) {
-      // Always return in register for unions for now.
-      // FIXME: This is wrong, but better than treating as a
-      // structure.
-      if (RetTy->isUnionType())
-        return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
-
-      // Small structures which are register sized are generally returned
-      // in a register.
-      if (X86_32ABIInfo::shouldReturnTypeInRegister(RetTy, Context))
-        return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
+    // Small structures which are register sized are generally returned
+    // in a register.
+    if (X86_32ABIInfo::shouldReturnTypeInRegister(RetTy, Context)) {
+      uint64_t Size = Context.getTypeSize(RetTy);
+      return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
     }
 
     return ABIArgInfo::getIndirect(0);

Modified: cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c?rev=71619&r1=71618&r2=71619&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c Tue May 12 21:58:55 2009
@@ -151,4 +151,7 @@
 // RUN: grep 'define float @f37()' %t &&
 struct s37 { float c[1][1]; } f37(void) {}
 
+// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t &&
+struct s38 { char a[3]; short b; } f38(void) {}
+
 // RUN: true





More information about the llvm-branch-commits mailing list