> Hi. > > As mentioned in the PR, there are classes in cgraph.h that are > not PODs and are initialized with ggc_alloc_cleared. So that I'm suggesting > to use proper constructors. I added ggc_new function that can be used > at different locations as well. > > I'm attaching optimized dump file with how ctor expansion looks like. > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? Thanks for working on this! I filled to PR to not forget to do this (since it can trigger wrong code if ggc allocation gets inlined) > + /* Default constructor. */ > + symtab_node (symtab_type t) > + : type (t), resolution (LDPR_UNKNOWN), definition (0), alias (0), > + transparent_alias (0), weakref (0), cpp_implicit_alias (0), symver (0), > + analyzed (0), writeonly (0), refuse_visibility_changes (0), > + externally_visible (0), no_reorder (0), force_output (0), > + forced_by_abi (0), unique_name (0), implicit_section (0), > + body_removed (0), used_from_other_partition (0), in_other_partition > (0), > + address_taken (0), in_init_priority_hash (0), need_lto_streaming (0), > + offloadable (0), ifunc_resolver (0), order (0), decl (NULL_TREE), I would use (false) for definition...order since these are flags. I think there is no need to initialize decl, next, previous since all allocations immediately put things into the symbol table and these items are always initialized explicitly. > + /* Default constructor. */ > + cgraph_node (int uid) > + : symtab_node (SYMTAB_FUNCTION), callees (NULL), callers (NULL), > + indirect_calls (NULL), origin (NULL), nested (NULL), next_nested > (NULL), > + next_sibling_clone (NULL), prev_sibling_clone (NULL), clones (NULL), > + clone_of (NULL), call_site_hash (NULL), former_clone_of (NULL), > + simdclone (NULL), simd_clones (NULL), ipa_transforms_to_apply (), > + inlined_to (NULL), rtl (NULL), clone (), thunk (), count (),
Will ipa_transformas_to_appl end up being NULL? count is initialized to profile_count::uninitialized in cgraph_node::created that also can eb moved here. > + count_materialization_scale (0), profile_id (0), unit_id (0), > + tp_first_run (0), used_as_abstract_origin (0), lowered (0), process > (0), > + frequency (), only_called_at_startup (0), only_called_at_exit (0), > + tm_clone (0), dispatcher_function (0), calls_comdat_local (0), > + icf_merged (0), nonfreeing_fn (0), merged_comdat (0), > + merged_extern_inline (0), parallelized_function (0), split_part (0), > + indirect_call_target (0), local (0), versionable (0), > + can_change_signature (0), redefined_extern_inline (0), > + tm_may_enter_irr (0), ipcp_clone (0), m_uid (uid), m_summary_id (-1) Again flags used_as_abstract_oriign...ipcp_clone are better as (false). OK with these changes. Honza