[cfe-commits] r89944 - /cfe/trunk/lib/CodeGen/CGCXX.cpp
Eli Friedman
eli.friedman at gmail.com
Wed Nov 25 23:45:48 PST 2009
Author: efriedma
Date: Thu Nov 26 01:45:48 2009
New Revision: 89944
URL: http://llvm.org/viewvc/llvm-project?rev=89944&view=rev
Log:
Shortcut explicit calls to a trivial copy assignment operator.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=89944&r1=89943&r2=89944&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Nov 26 01:45:48 2009
@@ -270,6 +270,14 @@
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.
More information about the cfe-commits
mailing list