Message ID | 1673884.m2ZVKc5Joq@polaris |
---|---|
State | New |
Headers | show |
Series | (patch] Do not put incomplete CONSTRUCTORs into static memory | expand |
On Tue, May 5, 2020 at 10:30 AM Eric Botcazou <botcazou@adacore.com> wrote: > > Hi, > > 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 even worse performance-wise, so > this prevents it from doing that for them. > > Tested on x86-64/Linux, OK for the mainline? OK. Richard. > > 2020-05-05 Eric Botcazou <ebotcazou@adacore.com> > > * gimplify.c (gimplify_init_constructor): Do not put the constructor > into static memory if it is not complete. > > > 2020-05-05 Eric Botcazou <ebotcazou@adacore.com> > > * gnat.dg/aggr29.adb: New test. > > -- > Eric Botcazou
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2f2c51b2d89..7807e30fb2e 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)) {