summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-04-28 22:57:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-04-28 22:57:55 +0000
commit03535265ef1633f7abde26010b0e17d96f27d463 (patch)
tree2a62f2e1fe1a057ae956f0287147401e01164acb /clang/lib/CodeGen/CGExprCXX.cpp
parente69c74832884db8166b379a04a87c9db91b2814e (diff)
downloadbcm5719-llvm-03535265ef1633f7abde26010b0e17d96f27d463.tar.gz
bcm5719-llvm-03535265ef1633f7abde26010b0e17d96f27d463.zip
Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.
-C++ objects with user-declared constructor don't need zero'ing. -We can zero-initialize arrays of C++ objects in "bulk" now, in which case don't zero-initialize each object again. llvm-svn: 130453
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 94f95053425..2f3e4680a79 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -370,8 +370,9 @@ CodeGenFunction::EmitCXXConstructExpr(const CXXConstructExpr *E,
// If we require zero initialization before (or instead of) calling the
// constructor, as can be the case with a non-user-provided default
- // constructor, emit the zero initialization now.
- if (E->requiresZeroInitialization())
+ // constructor, emit the zero initialization now, unless destination is
+ // already zeroed.
+ if (E->requiresZeroInitialization() && !Dest.isZeroed())
EmitNullInitialization(Dest.getAddr(), E->getType());
// If this is a call to a trivial default constructor, do nothing.
OpenPOWER on IntegriCloud