mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-25 16:50:49 +08:00
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.
This commit is contained in:
parent
0424a5ece5
commit
2badc98853
@ -1,3 +1,8 @@
|
||||
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 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/94949
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -1,3 +1,7 @@
|
||||
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/aggr29.adb: New test.
|
||||
|
||||
2020-05-05 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/94949
|
||||
|
12
gcc/testsuite/gnat.dg/aggr29.adb
Normal file
12
gcc/testsuite/gnat.dg/aggr29.adb
Normal file
@ -0,0 +1,12 @@
|
||||
-- { dg-do compile }
|
||||
-- { dg-options "-fdump-tree-gimple" }
|
||||
|
||||
with Ada.Streams; use Ada.Streams;
|
||||
|
||||
procedure Aggr29 is
|
||||
A : aliased Stream_Element_Array := (1 .. 512 => <>);
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
-- { dg-final { scan-tree-dump-not "a___UNC = \\*" "gimple" } }
|
Loading…
x
Reference in New Issue
Block a user