r237630 - Revert changes to DefaultABIInfo accidentally introduced in r208733
Reid Kleckner
reid at kleckner.net
Mon May 18 15:46:30 PDT 2015
Author: rnk
Date: Mon May 18 17:46:30 2015
New Revision: 237630
URL: http://llvm.org/viewvc/llvm-project?rev=237630&view=rev
Log:
Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions.
PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This
should worry you, because DefaultABIInfo is not implementing the rules
of any particular ABI.
Fixes PR23097, patch by Andy Gibbs.
Added:
cfe/trunk/test/CodeGenCXX/powerpc-byval.cpp
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=237630&r1=237629&r2=237630&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon May 18 17:46:30 2015
@@ -406,8 +406,16 @@ llvm::Value *DefaultABIInfo::EmitVAArg(l
}
ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty) const {
- if (isAggregateTypeForABI(Ty))
+ Ty = useFirstFieldIfTransparentUnion(Ty);
+
+ if (isAggregateTypeForABI(Ty)) {
+ // Records with non-trivial destructors/copy-constructors should not be
+ // passed by value.
+ if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI()))
+ return ABIArgInfo::getIndirect(0, RAA == CGCXXABI::RAA_DirectInMemory);
+
return ABIArgInfo::getIndirect(0);
+ }
// Treat an enum type as its underlying type.
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
Added: cfe/trunk/test/CodeGenCXX/powerpc-byval.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/powerpc-byval.cpp?rev=237630&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/powerpc-byval.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/powerpc-byval.cpp Mon May 18 17:46:30 2015
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=powerpc-unknown-linux | FileCheck %s
+
+struct S {
+ S();
+ ~S();
+};
+
+void byval(S one, S two) {
+ one = two;
+}
+
+// CHECK: define void @_Z5byval1SS_(%struct.S* %one, %struct.S* %two)
More information about the cfe-commits
mailing list