aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-05 12:31:26 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-05 12:39:09 +0200
commit2badc9885330b56dfabb49328c42de792bc67b1e (patch)
treeb22c407697e40808090e2657de0ce0508a9a6f99 /gcc/gimplify.c
parent0424a5ece5307cc22bbc0fe97edf4707d7a798ed (diff)
downloadgcc-2badc9885330b56dfabb49328c42de792bc67b1e.zip
gcc-2badc9885330b56dfabb49328c42de792bc67b1e.tar.gz
gcc-2badc9885330b56dfabb49328c42de792bc67b1e.tar.bz2
Do not put incomplete CONSTRUCTORs into static memory
The CONSTRUCTOR_NO_CLEARING flag was invented to avoid generating a memset for CONSTRUCTORS that lack elements, but it turns out that the gimplifier can generate a memcpy for them instead, which is worse performance-wise, so this prevents it from doing that for them. * gimplify.c (gimplify_init_constructor): Do not put the constructor into static memory if it is not complete.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2f2c51b..7807e30 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4995,8 +4995,8 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
all-zero initializers (which aren't big enough to merit
clearing), and don't try to make bitwise copies of
TREE_ADDRESSABLE types. */
-
if (valid_const_initializer
+ && complete_p
&& !(cleared || num_nonzero_elements == 0)
&& !TREE_ADDRESSABLE (type))
{