[cfe-commits] r109759 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGenCXX/x86_64-arguments.cpp
Chris Lattner
sabre at nondot.org
Thu Jul 29 10:04:54 PDT 2010
Author: lattner
Date: Thu Jul 29 12:04:54 2010
New Revision: 109759
URL: http://llvm.org/viewvc/llvm-project?rev=109759&view=rev
Log:
fix PR7742 / rdar://8250764, a miscompilation of struct
return where the struct has a base but no fields. This
was because the x86-64 abi logic was checking the wrong
predicate in one place.
This was introduced in r91874, which was a fix for PR5831,
which lacked a CHECK line, so I verified and added it.
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=109759&r1=109758&r2=109759&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Jul 29 12:04:54 2010
@@ -1026,8 +1026,9 @@
break;
}
- // If this record has no fields but isn't empty, classify as INTEGER.
- if (RD->field_empty() && Size)
+ // If this record has no fields, no bases, no vtable, but isn't empty,
+ // classify as INTEGER.
+ if (CXXRD->isEmpty() && Size)
Current = Integer;
}
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=109759&r1=109758&r2=109759&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp Thu Jul 29 12:04:54 2010
@@ -19,6 +19,7 @@
void f2(f2_s1 a0) { }
// PR5831
+// CHECK: define void @_Z2f34s3_1(i8 %x.coerce0, i64 %x.coerce1)
struct s3_0 {};
struct s3_1 { struct s3_0 a; long b; };
void f3(struct s3_1 x) {}
@@ -44,4 +45,19 @@
// CHECK: call void @_ZN6PR752310AddKeywordENS_9StringRefEi(i8* {{.*}}, i32 4)
AddKeyword(StringRef(), 4);
}
+}
+
+
+
+namespace PR7742 { // Also rdar://8250764
+ struct s2 {
+ float a[2];
+ };
+
+ struct c2 : public s2 {};
+
+ // CHECK: define double @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
+ c2 foo(c2 *P) {
+ }
+
}
\ No newline at end of file
More information about the cfe-commits
mailing list