[cfe-commits] r168959 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGen/x86_32-arguments-darwin.c

Eli Friedman eli.friedman at gmail.com
Thu Nov 29 15:21:04 PST 2012


Author: efriedma
Date: Thu Nov 29 17:21:04 2012
New Revision: 168959

URL: http://llvm.org/viewvc/llvm-project?rev=168959&view=rev
Log:
Fix a small calling-convention bug for x86-32.  PR14453.


Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/test/CodeGen/x86_32-arguments-darwin.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=168959&r1=168958&r2=168959&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Nov 29 17:21:04 2012
@@ -266,9 +266,15 @@
 }
 
 static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
+  // Treat complex types as the element type.
+  if (const ComplexType *CTy = Ty->getAs<ComplexType>())
+    Ty = CTy->getElementType();
+
+  // Check for a type which we know has a simple scalar argument-passing
+  // convention without any padding.  (We're specifically looking for 32
+  // and 64-bit integer and integer-equivalents, float, and double.)
   if (!Ty->getAs<BuiltinType>() && !Ty->hasPointerRepresentation() &&
-      !Ty->isAnyComplexType() && !Ty->isEnumeralType() &&
-      !Ty->isBlockPointerType())
+      !Ty->isEnumeralType() && !Ty->isBlockPointerType())
     return false;
 
   uint64_t Size = Context.getTypeSize(Ty);

Modified: cfe/trunk/test/CodeGen/x86_32-arguments-darwin.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments-darwin.c?rev=168959&r1=168958&r2=168959&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments-darwin.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments-darwin.c Thu Nov 29 17:21:04 2012
@@ -337,3 +337,8 @@
   __builtin_va_end(ap);
   return v;
 }
+
+// PR14453
+struct s67 { _Complex unsigned short int a; };
+void f67(struct s67 x) {}
+// CHECK: define void @f67(%struct.s67* byval align 4 %x)





More information about the cfe-commits mailing list