[cfe-commits] r91874 - in /cfe/trunk: lib/CodeGen/TargetABIInfo.cpp test/CodeGenCXX/member-functions.cpp test/CodeGenCXX/x86_64-arguments.cpp

Daniel Dunbar daniel at zuster.org
Mon Dec 21 17:19:26 PST 2009


Author: ddunbar
Date: Mon Dec 21 19:19:25 2009
New Revision: 91874

URL: http://llvm.org/viewvc/llvm-project?rev=91874&view=rev
Log:
x86_64: Structures with no fields but which have padding should be classified as
integer.
 - This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
 - PR5831.

Modified:
    cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
    cfe/trunk/test/CodeGenCXX/member-functions.cpp
    cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Mon Dec 21 19:19:25 2009
@@ -805,6 +805,10 @@
         if (Lo == Memory || Hi == Memory)
           break;
       }
+
+      // If this record has no fields but isn't empty, classify as INTEGER.
+      if (RD->field_empty() && Size)
+        Current = Integer;
     }
 
     // Classify the fields one at a time, merging the results.

Modified: cfe/trunk/test/CodeGenCXX/member-functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-functions.cpp?rev=91874&r1=91873&r2=91874&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-functions.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-functions.cpp Mon Dec 21 19:19:25 2009
@@ -58,6 +58,6 @@
 void test3() {
   T t1, t2;
   
-  // RUN: grep "call void @_ZN1TpsERKS_" %t
+  // RUN: grep "call i64 @_ZN1TpsERKS_" %t
   T result = t1 + t2;
 }

Modified: cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp?rev=91874&r1=91873&r2=91874&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp Mon Dec 21 19:19:25 2009
@@ -21,4 +21,7 @@
 // CHECK: define void @_Z2f25f2_s1([[i64_i64_ty]])
 void f2(f2_s1 a0) { }
 
-
+// PR5831
+struct s3_0 {};
+struct s3_1 { struct s3_0 a; long b; };
+void f3(struct s3_1 x) {}





More information about the cfe-commits mailing list