aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-11-26 07:45:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-11-26 07:45:48 +0000
commitae32e2459edad5cd13384c70a726d7ecb78c9b5c (patch)
tree7d17da85306044460adf84a57901c64e24f80663
parent15233e5a4d98b66b3c6cfcc4e6413ad776a79481 (diff)
Shortcut explicit calls to a trivial copy assignment operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89944 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGCXX.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 3b97fcb117..a0b02d53b6 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -270,6 +270,14 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
This = BaseLV.getAddress();
}
+ if (MD->isCopyAssignment() && MD->isTrivial()) {
+ // We don't like to generate the trivial copy assignment operator when
+ // it isn't necessary; just produce the proper effect here.
+ llvm::Value *RHS = EmitLValue(*CE->arg_begin()).getAddress();
+ EmitAggregateCopy(This, RHS, CE->getType());
+ return RValue::get(This);
+ }
+
// C++ [class.virtual]p12:
// Explicit qualification with the scope operator (5.1) suppresses the
// virtual call mechanism.