Do not allocate huge array in output_in_order.
authorMartin Liska <mliska@suse.cz>
Thu, 30 Jul 2020 07:24:40 +0000 (09:24 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 31 Jul 2020 10:14:38 +0000 (12:14 +0200)
commit8bd062e8ad44e70be04108232e1ef597fc3b3e3e
treea5e39e75e1fd5eea596c71dbbebf2f74fd4a2bf4
parent10231958fcfb13bc4847729eba21470c101b4a88
Do not allocate huge array in output_in_order.

We noticed that when analyzing LTRANS memory peak that happens right
after the start:
https://gist.github.com/marxin/223890df4d8d8e490b6b2918b77dacad

In case of chrome, we have symtab->order == 200M, so we allocate
16B * 200M = 3.2GB.

gcc/ChangeLog:

* cgraph.h: Remove leading empty lines.
* cgraphunit.c (enum cgraph_order_sort_kind): Remove
ORDER_UNDEFINED.
(struct cgraph_order_sort): Add constructors.
(cgraph_order_sort::process): New.
(cgraph_order_cmp): New.
(output_in_order): Simplify and push nodes to vector.
gcc/cgraph.h
gcc/cgraphunit.c