]> granicus.if.org Git - clang/commitdiff
Fix a small calling-convention bug for x86-32. PR14453.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 29 Nov 2012 23:21:04 +0000 (23:21 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 29 Nov 2012 23:21:04 +0000 (23:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168959 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp
test/CodeGen/x86_32-arguments-darwin.c

index 1582eb6354446bf136cc6da4d00f8b36c79fbb67..8ff57f6c20ab083908255925c67c3c6d7d24599d 100644 (file)
@@ -266,9 +266,15 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
 }
 
 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);
index 5bbc80b9398b276843f8464b058b0dfa3b323854..917ba72e0b1956150a9a2ae59fa65a6bc6ce4427 100644 (file)
@@ -337,3 +337,8 @@ T66 f66(int i, ...) {
   __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)