[cfe-commits] r71266 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/x86_32-arguments.c

Daniel Dunbar daniel at zuster.org
Fri May 8 14:04:47 PDT 2009


Author: ddunbar
Date: Fri May  8 16:04:47 2009
New Revision: 71266

URL: http://llvm.org/viewvc/llvm-project?rev=71266&view=rev
Log:
Darwin x86_32: Ignore padding bit-fields when looking for "single
element" structures.

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

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=71266&r1=71265&r2=71266&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri May  8 16:04:47 2009
@@ -204,11 +204,15 @@
       if (AT->getSize().getZExtValue() == 1)
         FT = AT->getElementType();
 
-    if (isEmptyRecord(Context, FT)) {
-      // Ignore
-    } else if (Found) {
+    // Ignore empty records and padding bit-fields.
+    if (isEmptyRecord(Context, FT) || 
+        (FD->isBitField() && !FD->getIdentifier()))
+      continue;
+
+    if (Found)
       return 0;
-    } else if (!CodeGenFunction::hasAggregateLLVMType(FT)) {
+
+    if (!CodeGenFunction::hasAggregateLLVMType(FT)) {
       Found = FT.getTypePtr();
     } else {
       Found = isSingleElementStruct(FT, Context);

Modified: cfe/trunk/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments.c?rev=71266&r1=71265&r2=71266&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments.c Fri May  8 16:04:47 2009
@@ -130,4 +130,7 @@
 // RUN: grep 'define i16 @f30()' %t &&
 struct s30 { char a; char b : 4; } f30(void) {}
 
+// RUN: grep 'define float @f31()' %t &&
+struct s31 { char : 0; float b; char : 0} f31(void) {}
+
 // RUN: true





More information about the cfe-commits mailing list