]> granicus.if.org Git - clang/commitdiff
Darwin x86_32: Ignore arrays of empty structures inside records.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 8 May 2009 20:21:04 +0000 (20:21 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 8 May 2009 20:21:04 +0000 (20:21 +0000)
 - This eliminates 5/1000 failures on return-types-32, on the current
   ABITest config.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71250 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
test/CodeGen/x86_32-arguments.c

index 27322525bb2ac36291dd325dc98df6acb0fdd0fe..e9f2bba303b7266b1678a7aff57b0460e4b0a786 100644 (file)
@@ -350,6 +350,13 @@ bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
     if (isEmptyRecord(Context, FD->getType()))
       continue;
 
+    // As are arrays of empty structures, but not generally, so we
+    // can't add this test higher in this routine.
+    if (const ConstantArrayType *AT = 
+        Context.getAsConstantArrayType(FD->getType()))
+      if (isEmptyRecord(Context, AT->getElementType()))
+        continue;
+
     // Check fields recursively.
     if (!shouldReturnTypeInRegister(FD->getType(), Context))
       return false;
index 95307e929ad73161e35b565eb6671f4724c264a0..14144c438ca84d447ef22f5fa544cf7d2c6455bc 100644 (file)
@@ -120,10 +120,13 @@ struct { struct {} a; struct { float a[1]; } b; } f25(void) {}
 // Small structures are handled recursively
 // RUN: grep -F 'i32 @f26()' %t &&
 // RUN: grep 'void @f27(%.truct.s27\* noalias sret %agg.result)' %t &&
-struct s26 { struct { char a, b; } a; struct { char a, b } b; } f26(void) {}
-struct s27 { struct { char a, b, c; } a; struct { char a } b; } f27(void) {}
+struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) {}
+struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) {}
 
 // RUN: grep 'void @f28(%.truct.s28\* noalias sret %agg.result)' %t &&
-struct s28 { int a; int b[] } f28(void) {}
+struct s28 { int a; int b[]; } f28(void) {}
+
+// RUN: grep 'define i16 @f29()' %t &&
+struct s29 { struct { } a[1]; char b; char c; } f29(void) {}
 
 // RUN: true