* ipa-utils.h (method_class_type): Remove.
* cgraphunit.c (walk_polymorphic_call_targets): Use TYPE_METHOD_BASETYPE.
* ipa-devirt.c (type_in_anonymous_namespace_p): Check that it is called
on main variants only.
(method_class_type): Remove.
(update_type_inheritance_graph): Use TYPE_METHOD_BASETYPE.
(build_type_inheritance_graph): Likewise.
* ipa-icf.c (sem_function::equals_wpa): Likewise.
* pa-polymorphic-call.c (decl_maybe_in_construction_p,
check_stmt_for_type_change): Use TYPE_METHOD_BASETYPE.
From-SVN: r223629
* ipa-devirt.c (type_in_anonymous_namespace_p): Return true
or implicit declarations.
(odr_type_p): Check that TYPE_NAME is TYPE_DECL before looking
into it.
(get_odr_type): Check type has linkage before adding bases.
(register_odr_type): Check that type has linkage before adding it.
(type_known_to_have_no_deriavations_p): Rename to ..
(type_known_to_have_no_derivations_p): This one.
* ipa-utils.h (type_known_to_have_no_deriavations_p): Rename to ..
(type_known_to_have_no_derivations_p): This one.
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::restrict_to_inner_type): Check that
type has linkage.
From-SVN: r223415
* ipa-devirt.c (type_with_linkage_p): New function.
(type_in_anonymous_namespace_p): Move here from tree.c; assert that
type has linkage.
(odr_type_p): Move here from ipa-utils.h; use type_with_linkage_p.
(can_be_name_hashed_p): Simplify.
(hash_odr_name): Check that type has linkage before checking if it is
anonymous.
(types_same_for_odr): Likewise.
(odr_name_hasher::equal): Likewise.
(odr_subtypes_equivalent_p): Likewise.
(warn_types_mismatch): Likewise.
(get_odr_type): Likewise.
(odr_types_equivalent_p): Fix checking of TYPE_MAIN_VARIANT.
* ipa-utils.h (odr_type_p): Move offline.
* tree.c (need_assembler_name_p): Fix handling of types
without linkages.
(type_in_anonymous_namespace_p): Move to ipa-devirt.c
From-SVN: r223094
PR ipa/65610
* ipa-utils.h (inlined_polymorphic_ctor_dtor_block_p): Declare.
* ipa-polymorphic-call.c (inlined_polymorphic_ctor_dtor_block_p): New
function.
(decl_maybe_in_construction_p, noncall_stmt_may_be_vtbl_ptr_store):
Use it.
* ipa-prop.c (param_type_may_change_p): Likewise.
* tree-ssa-live.c: Include ipa-utils.h and its dependencies.
(remove_unused_scope_block_p): Add in_ctor_dtor_block
argument. Before inlining, preserve
inlined_polymorphic_ctor_dtor_block_p blocks and the outermost block
with FUNCTION_DECL BLOCK_ABSTRACT_ORIGIN inside of them. Adjust
recursive calls.
(remove_unused_locals): Adjust remove_unused_scope_block_p caller.
* g++.dg/ubsan/pr65610.C: New test.
From-SVN: r221781
* tree.c (free_lang_data_in_type): If BINFO has no important
information in it, set it to NULL.
(get_binfo_at_offset): Do not walk fields, only bases.
* ipa-utils.h (polymorphic_type_binfo_p): Be ready for BINFO_TYPE
to be NULL.
* ipa-polymorphic-call.c (record_known_type): Likewise.
From-SVN: r217824
* ipa-devirt.c (polymorphic_call_target_d): Add SPECULATIVE; reorder
for better storage.
(polymorphic_call_target_hasher::hash): Hash SPECULATIVE.
(possible_polymorphic_call_targets): Instead of computing both
speculative and non-speculative answers, do just one at a time.
Replace NONSPECULATIVE_TARGETSP parameter with SPECULATIVE flag.
(dump_targets): Break out from ...
(dump_possible_polymorphic_call_targets): ... here; dump both speculative
and non-speculative lists.
(ipa_devirt): Update for new possible_polymorphic_call_targets API.
* ipa-utils.h (possible_polymorphic_call_targets): Update.
* testsuite/g++.dg/ipa/devirt-34.C: Update template.
From-SVN: r215614
* cgraph.h (class ipa_polymorphic_call_context): Move here from
ipa-utils.h; add stream_int and stream_out methods.
(cgraph_indirect_call_info): Remove SPECILATIVE_OFFSET,
OUTER_TYPE, SPECULATIVE_OUTER_TYPE, MAYBE_IN_CONSTRUCTION
MAYBE_DERIVED_TYPE and SPECULATIEVE_MAYBE_DERIVED_TYPE;
add CONTEXT.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context,
ipa_polymorphic_call_context::ipa_polymorphic_call_context,
ipa_polymorphic_call_context::clear_speculation,
ipa_polymorphic_call_context::clear_outer_type): Move here from
ipa-utils.h
* ipa-utils.h (class ipa_polymorphic_call_context): Move to cgraph.h
(ipa_polymorphic_call_context::ipa_polymorphic_call_context,
ipa_polymorphic_call_context::ipa_polymorphic_call_context,
ipa_polymorphic_call_context::clear_speculation,
ipa_polymorphic_call_context::clear_outer_type): Likewise.
* ipa-devirt.c: Include data-streamer.h, lto-streamer.h and
streamer-hooks.h
(ipa_polymorphic_call_context::stream_out): New method.
(ipa_polymorphic_call_context::stream_in): New method.
(noncall_stmt_may_be_vtbl_ptr_store): Add forgotten static.
* ipa-prop.c (ipa_analyze_indirect_call_uses): Do not care about
OUTER_TYPE.
(ipa_analyze_call_uses): Simplify.
(update_indirect_edges_after_inlining): Do not care about outer_type.
(ipa_write_indirect_edge_info): Update.
(ipa_write_indirect_edge_info): Likewise.
* cgraph.c (cgraph_node::create_indirect_edge): Simplify.
(dump_edge_flags): Break out from ...
(cgraph_node::dump): ... here; dump indirect edges.
From-SVN: r215575
* ipa-utils.h (polymorphic_call_context): Add
metdhos dump, debug and clear_outer_type.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Simplify.
(ipa_polymorphic_call_context::clear_outer_type): New method.
* ipa-prop.c (ipa_analyze_call_uses): Do not overwrite offset.
* ipa-devirt.c (types_odr_comparable): New function.
(types_must_be_same_for_odr): New function.
(odr_subtypes_equivalent_p): Simplify.
(possible_placement_new): Break out from ...
(ipa_polymorphic_call_context::restrict_to_inner_type): ... here;
be more cuatious about returning false in cases the context may be
valid in derived type or via placement new.
(contains_type_p): Clear maybe_derived_type
(ipa_polymorphic_call_context::dump): New method.
(ipa_polymorphic_call_context::debug): New method.
(ipa_polymorphic_call_context::set_by_decl): Cleanup comment.
(ipa_polymorphic_call_context::set_by_invariant): Simplify.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Simplify.
(possible_polymorphic_call_targets): Trust context.restrict_to_inner_class
to suceed on all valid cases; remove confused sanity check.
(dump_possible_polymorphic_call_targets): Simplify.
From-SVN: r215569
* common.opt (flto-odr-type-merging): New flag.
* ipa-deivrt.c (hash_type_name): Use ODR names for hasing if availale.
(types_same_for_odr): Likewise.
(odr_subtypes_equivalent_p): Likewise.
(add_type_duplicate): Do not walk type variants.
(register_odr_type): New function.
* ipa-utils.h (register_odr_type): Declare.
(odr_type_p): New function.
* langhooks.c (lhd_set_decl_assembler_name): Do not compute
TYPE_DECLs
* doc/invoke.texi (-flto-odr-type-merging): Document.
* tree.c (need_assembler_name_p): Compute ODR names when asked
for it.
* tree.h (DECL_ASSEMBLER_NAME): Update comment.
* lto.c (lto_read_decls): Register ODR types.
From-SVN: r215196
* ipa-devirt.c: Include gimple-pretty-print.h
(referenced_from_vtable_p): Exclude DECL_EXTERNAL from
further tests.
(decl_maybe_in_construction_p): Fix conditional on cdtor check
(get_polymorphic_call_info): Fix return value
(type_change_info): New sturcture based on ipa-prop
variant.
(noncall_stmt_may_be_vtbl_ptr_store): New predicate
based on ipa-prop variant.
(extr_type_from_vtbl_ptr_store): New function
based on ipa-prop variant.
(record_known_type): New function.
(check_stmt_for_type_change): New function.
(get_dynamic_type): New function.
* ipa-prop.c (ipa_analyze_call_uses): Use get_dynamic_type.
* tree-ssa-pre.c: ipa-utils.h
(eliminate_dom_walker::before_dom_children): Use ipa-devirt
machinery; sanity check with ipa-prop devirtualization.
* trans-mem.c (ipa_tm_insert_gettmclone_call): Clear
polymorphic flag.
* g++.dg/ipa/devirt-35.C: New testcase.
* g++.dg/ipa/devirt-36.C: New testcase.
From-SVN: r213739
* cgraph.h (symtab_node):
(void register_symbol (void)): created from symtab_register_node
(void remove (void)): created from symtab_remove_node
(void dump (FILE *f)): created from dump_symtab_node
(void DEBUG_FUNCTION debug (void)): created from debug_symtab_node
(void DEBUG_FUNCTION verify (void)): created from verify_symtab_node
(struct ipa_ref *add_reference (symtab_node *referred_node,
enum ipa_ref_use use_type)): created from add_reference
(struct ipa_ref *add_reference (symtab_node *referred_node,
enum ipa_ref_use use_type, gimple stmt)): created from add_reference
(struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type,
gimple stmt)): created from maybe_add_reference
(bool semantically_equivalent_p (symtab_node *target)): created from
symtab_semantically_equivalent_p
(void remove_from_same_comdat_group (void)): created from
remove_from_same_comdat_group
(void add_to_same_comdat_group (symtab_node *old_node)): created from
symtab_add_to_same_comdat_group
(void dissolve_same_comdat_group_list (void)): created from
symtab_dissolve_same_comdat_group_list
(bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p
(symtab_node *ultimate_alias_target (enum availability *avail = NULL)):
created from symtab_alias_ultimate_target
(inline symtab_node *next_defined_symbol (void)): created from
symtab_next_defined_symbol
(bool resolve_alias (symtab_node *target)): created from
symtab_resolve_alias
(bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *),
void *data, bool include_overwrite)): created from symtab_for_node_and_aliases
(symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias
(inline symtab_node *get_alias_target (void)): created from symtab_alias_target
(void set_section (const char *section)): created from set_section_1
(enum availability get_availability (void)): created from symtab_node_availability
(void make_decl_local (void)): created from symtab_make_decl_local
(bool real_symbol_p (void)): created from symtab_read_node
(can_be_discarded_p (void)): created from symtab_can_be_discarded
(inline bool comdat_local_p (void)): created from symtab_comdat_local_p
(inline bool in_same_comdat_group_p (symtab_node *target)): created from
symtab_in_same_comdat_p;
(bool address_taken_from_non_vtable_p (void)): created from
address_taken_from_non_vtable_p
(static inline symtab_node *get (const_tree decl)): created from symtab_get_node
(static void dump_table (FILE *)): created from dump_symtab
(static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab
(static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab
(static bool used_from_object_file_p_worker (symtab_node *node)): created from
symtab_used_from_object_file_p
(void dump_base (FILE *)): created from dump_symtab_base
(bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base
(void unregister (void)): created from symtab_unregister_node
(struct symbol_priority_map *priority_info (void)): created from symtab_priority_info
(static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section
(static bool noninterposable_alias (symtab_node *node, void *data)): created from
symtab_nonoverwritable_alias_1
* cgraph.h (cgraph_node):
(bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)):
created from cgraph_remove_node_and_inline_clones
(void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references
(void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt,
bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones
(cgraph_node *function_symbol (enum availability *avail = NULL)):
created from cgraph_function_node
(cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original,
vec<cgraph_edge *> redirect_callers, bool call_duplication_hook,
struct cgraph_node *new_inlined_to, bitmap args_to_skip)):
created from cgraph_create_clone
(cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers,
vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)):
created from cgraph_create_virtual_clone
(cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node
(cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers,
bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning
(cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers,
vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return,
bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)):
created from cgraph_function_version_info
(struct cgraph_function_version_info *insert_new_function_version (void)):
created from insert_new_cgraph_node_version
(struct cgraph_function_version_info *function_version (void)): created from
get_cgraph_node_version
(void analyze (void)): created from analyze_function
(cgraph_node * create_thunk (tree alias, tree, bool this_adjusting,
HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset,
tree real_alias) cgraph_add_thunk
(inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target
(cgraph_node *ultimate_alias_target (availability *availability = NULL)):
created from cgraph_function_or_thunk_node
(bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)):
created from expand_thunk
(void reset (void)): created from cgraph_reset_node
(void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper
(void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node
(void remove (void)): created from cgraph_remove_node
(void dump (FILE *f)): created from dump_cgraph_node
(void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node
(bool get_body (void)): created from cgraph_get_body
(void release_body (void)): created from cgraph_release_function_body
(void unnest (void)): created from cgraph_unnest_node
(void make_local (void)): created from cgraph_make_node_local
(void mark_address_taken (void)): created from cgraph_mark_address_taken_node
(struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt,
gcov_type count, int freq)): created from cgraph_create_edge
(struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags,
gcov_type count, int freq)): created from cgraph_create_indirect_edge
(void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt,
gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)):
created from cgraph_create_edge_including_clones
(cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge
(vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node
(void remove_callers (void)): created from cgraph_node_remove_callers
(void remove_callees (void)): created from cgraph_node_remove_callees
(enum availability get_availability (void)): created from cgraph_function_body_availability
(void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag
(void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag
(void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag
(void call_duplication_hooks (cgraph_node *node2)): created from
cgraph_call_node_duplication_hooks
(bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *),
void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases
(bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data),
void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases
(void call_function_insertion_hooks (void)):
created from cgraph_call_function_insertion_hooks
(inline void mark_force_output (void)): created from cgraph_mark_force_output_node
(bool local_p (void)): created from cgraph_local_node
(bool can_be_local_p (void)): created from cgraph_node_can_be_local_p
(bool cannot_return_p (void)): created from cgraph_node_cannot_return
(bool only_called_directly_p (void)): created from cgraph_only_called_directly_p
(inline bool only_called_directly_or_aliased_p (void)):
created from cgraph_only_called_directly_or_aliased_p
(bool will_be_removed_from_program_if_no_direct_calls_p (void)):
created from cgraph_will_be_removed_from_program_if_no_direct_calls
(bool can_remove_if_no_direct_calls_and_refs_p (void)):
created from cgraph_can_remove_if_no_direct_calls_and_refs_p
(bool can_remove_if_no_direct_calls_p (void)):
created from cgraph_can_remove_if_no_direct_calls_p
(inline bool has_gimple_body_p (void)):
created from cgraph_function_with_gimple_body_p
(bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p
(static void dump_cgraph (FILE *f)): created from dump_cgraph
(static inline void debug_cgraph (void)): created from debug_cgraph
(static void record_function_versions (tree decl1, tree decl2)):
created from record_function_versions
(static void delete_function_version (tree decl)):
created from delete_function_version
(static void add_new_function (tree fndecl, bool lowered)):
created from cgraph_add_new_function
(static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node
(static cgraph_node * create (tree decl)): created from cgraph_create_node
(static cgraph_node * create_empty (void)): created from cgraph_create_empty_node
(static cgraph_node * get_create (tree)): created from cgraph_get_create_node
(static cgraph_node *get_for_asmname (tree asmname)):
created from cgraph_node_for_asm
(static cgraph_node * create_same_body_alias (tree alias, tree decl)):
created from cgraph_same_body_alias
(static bool used_from_object_file_p_worker (cgraph_node *node,
void *): new function
(static bool non_local_p (cgraph_node *node, void *)):
created from cgraph_non_local_node_p_1
(static void DEBUG_FUNCTION verify_cgraph_nodes (void)):
created from verify_cgraph
(static bool make_local (cgraph_node *node, void *)):
created from cgraph_make_node_local
(static cgraph_node *create_alias (tree alias, tree target)):
created from cgraph_create_function_alias
(static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee,
gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)):
created from cgraph_create_edge_1
* cgraph.h (varpool_node):
(void remove (void)): created from varpool_remove_node
(void dump (FILE *f)): created from dump_varpool_node
From-SVN: r212982
* cgraph.c (cgraph_create_indirect_edge): Update call of
get_polymorphic_call_info.
* ipa-utils.h (get_polymorphic_call_info): Add parameter CALL.
(possible_polymorphic_call_targets): Add parameter call.
(decl_maybe_in_construction_p): New predicate.
(get_polymorphic_call_info): Add parameter call;
use decl_maybe_in_construction_p.
* gimple-fold.c (fold_gimple_assign): Update use of
possible_polymorphic_call_targets.
(gimple_fold_call): Likewise.
* ipa-prop.c: Inlcude calls.h
(ipa_binfo_from_known_type_jfunc): Check that known type is record.
(param_type_may_change_p): New predicate.
(detect_type_change_from_memory_writes): Break out from ...
(detect_type_change): ... this one; use
param_type_may_change_p.
(detect_type_change_ssa): Use param_type_may_change_p.
(compute_known_type_jump_func): Use decl_maybe_in_construction_p.
* g++.dg/ipa/devirt-26.C: Update testcase.
* g++.dg/ipa/imm-devirt-1.C: Update testcase.
* g++.dg/ipa/imm-devirt-2.C: Update testcase.
From-SVN: r212304
* ipa-cp.c (ipa_get_indirect_edge_target_1): Do direct
lookup via vtable pointer; check for type consistency
and turn inconsitent facts into UNREACHABLE.
* ipa-prop.c (try_make_edge_direct_virtual_call): Likewise.
* gimple-fold.c (gimple_get_virt_method_for_vtable):
Do not ICE on type inconsistent querries; return UNREACHABLE
instead.
* testsuite/g++.dg/ipa/devirt-25.C: New testcase.
From-SVN: r207448
PR ipa/59831
* g++.dg/ipa/devirt-24.C: New testcase.
* ipa-cp.c (ipa_get_indirect_edge_target_1): Give up on -fno-devirtualize;
Try to devirtualize by the knowledge of virtual table pointer given by
aggregate propagation.
* ipa-prop.c (try_make_edge_direct_virtual_call): Likewise.
ipa_print_node_jump_functions): Dump also offset that
is relevant for polymorphic calls.
(determine_known_aggregate_parts): Add arg_type parameter; use it
instead of determining the type from pointer type.
(ipa_compute_jump_functions_for_edge): Update call of
determine_known_aggregate_parts.
* gimple-fold.c (gimple_get_virt_method_for_vtable): Break out from ...
(gimple_get_virt_method_for_binfo): ... here; simplify using
vtable_pointer_value_to_vtable.
* gimple-fold.h (gimple_get_virt_method_for_vtable): Declare.
* ipa-devirt.c (subbinfo_with_vtable_at_offset): Turn OFFSET parameter
to unsigned HOST_WIDE_INT; Use vtable_pointer_value_to_vtable.
(vtable_pointer_value_to_vtable): Break out from ...; handle also
POINTER_PLUS_EXPR.
(vtable_pointer_value_to_binfo): ... here.
* ipa-utils.h (vtable_pointer_value_to_vtable): Declare.
From-SVN: r207439
* cgraph.c (cgraph_create_indirect_edge): Use get_polymorphic_call_info.
* cgraph.h (cgraph_indirect_call_info): Add outer_type, maybe_in_construction
and maybe_derived_type.
* ipa-utils.h (ipa_polymorphic_call_context): New structure.
(ipa_dummy_polymorphic_call_context): New global var.
(possible_polymorphic_call_targets): Add context paramter.
(dump_possible_polymorphic_call_targets): Likewise; update
wrappers.
(possible_polymorphic_call_target_p): Likewise.
(get_polymorphic_call_info): New function.
* ipa-devirt.c (ipa_dummy_polymorphic_call_context): New function.
(add_type_duplicate): Remove forgotten debug output.
(method_class_type): Add sanity check.
(maybe_record_node): Add FINALP parameter.
(record_binfo): Add OUTER_TYPE and OFFSET; walk the inner
by info by get_binfo_at_offset.
(possible_polymorphic_call_targets_1): Add OUTER_TYPE/OFFSET parameters;
pass them to record-binfo.
(polymorphic_call_target_d): Add context and FINAL.
(polymorphic_call_target_hasher::hash): Hash context.
(polymorphic_call_target_hasher::equal): Compare context.
(free_polymorphic_call_targets_hash):
(get_class_context): New function.
(contains_type_p): New function.
(get_polymorphic_call_info): New function.
(walk_bases): New function.
(possible_polymorphic_call_targets): Add context parameter; honnor it.
(dump_possible_polymorphic_call_targets): Dump context.
(possible_polymorphic_call_target_p): Add context.
(update_type_inheritance_graph): Update comment.s
(ipa_set_jf_known_type): Assert that compoentn type is known.
(ipa_note_param_call): Do not tamper with offsets.
(ipa_analyze_indirect_call_uses): When offset is being changed; clear
outer type.
(update_indirect_edges_after_inlining): Likewise.
(ipa_write_indirect_edge_info): Stream new fields.
(ipa_read_indirect_edge_info): Stream in new fields.
* ipa/devirt9.C: Verify that the optimization happens already before.
whole-program.
From-SVN: r205019
gcc/ada/
* gcc-interface/cuintp.c (UI_From_gnu): Use tree_to_shwi rather than
tree_low_cst.
gcc/c-family/
* c-common.c (fold_offsetof_1): Use tree_to_uhwi rather than
tree_low_cst.
(complete_array_type): Update comment to refer to tree_to_[su]hwi
rather than tree_low_cst.
gcc/c/
* c-decl.c (grokdeclarator): Update comment to refer to
tree_to_[su]hwi rather than tree_low_cst.
gcc/cp/
* decl.c (reshape_init_array_1): Use tree_to_uhwi rather than
tree_low_cst.
(grokdeclarator): Update comment to refer to tree_to_[su]hwi rather
than tree_low_cst.
gcc/
* expr.h: Update comments to refer to tree_to_[su]hwi rather
than tree_low_cst.
* fold-const.c (fold_binary_loc): Likewise.
* expr.c (store_constructor): Use tree_to_uhwi rather than
tree_low_cst.
* ipa-utils.h (possible_polymorphic_call_target_p): Likewise.
* stmt.c (emit_case_dispatch_table): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
From-SVN: r204962
This moves tree.h out of every header. This exposes dependencies of
tree.h in files that should probably not need it after tree and gimple
are separated.
After this change, no header should include tree.h directly. It should
only be included by a .c file. Unfortunately, I did not find an
automatic way of forcing this.
Tested on x86_64 with all languages enabled and using
contrib/config-list.mk.
2013-10-21 Diego Novillo <dnovillo@google.com>
* asan.c: Include tree.h
* bb-reorder.c: Likewise.
* cfgcleanup.c: Likewise.
* cfgloopmanip.c: Likewise.
* data-streamer-in.c: Likewise.
* data-streamer-out.c: Likewise.
* data-streamer.c: Likewise.
* dwarf2cfi.c: Likewise.
* graphite-blocking.c: Likewise.
* graphite-clast-to-gimple.c: Likewise.
* graphite-dependences.c: Likewise.
* graphite-interchange.c: Likewise.
* graphite-optimize-isl.c: Likewise.
* graphite-poly.c: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* graphite.c: Likewise.
* ipa-devirt.c: Likewise.
* ipa-profile.c: Likewise.
* ipa.c: Likewise.
* ira.c: Likewise.
* loop-init.c: Likewise.
* loop-unroll.c: Likewise.
* lower-subreg.c: Likewise.
* lto/lto-object.c: Likewise.
* recog.c: Likewise.
* reginfo.c: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-parloops.c: Likewise.
* tree-ssa-strlen.c: Likewise.
* tree-streamer.c: Likewise.
* value-prof.c: Likewise.
* target-globals.c: Likewise.
* expr.h: Include tree-core.h instead of tree.h.
* gimple.h: Likewise.
* ipa-prop.h: Likewise.
* ipa-utils.h: Likewise.
* lto-streamer.h: Likewise.
* streamer-hooks.h: Likewise.
* ipa-reference.h: Include cgraph.h instead of tree.h.
* cgraph.h: Include basic-block.h instead of tree.h.
* tree-streamer.h: Do not include tree.h.
* genattrtab.c (write_header): Generate inclusion of
tree.h.
* genautomata.c (main): Likewise.
* genemit.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c (output_prologue): Likewise.
* genpeep.c: Likewise.
testsuite/ChangeLog
* g++.dg/plugin/selfassign.c: Include tree.h.
* gcc.dg/plugin/finish_unit_plugin.c: Likewise.
* gcc.dg/plugin/ggcplug.c: Likewise.
* gcc.dg/plugin/one_time_plugin.c: Likewise.
* gcc.dg/plugin/selfassign.c: Likewise.
* gcc.dg/plugin/start_unit_plugin.c: Likewise.
From-SVN: r203908
* ipa-cp.c (ipa_get_indirect_edge_target_1): Add sanity check
for ipa-devirt.
* ipa-utils.h (possible_polymorphic_call_target_p): New function.
* ipa-devirt.c (possible_polymorphic_call_target_p): Be tolerant
of external calls
* gimple-fold.c: Include ipa-utils.h and gimple-pretty-print.h
(gimple_fold_call): Dump inconsistent devirtualizations; add
sanity check for type based devirtualizations.
* ipa-prop.c: Include ipa-utils.h
(ipa_intraprocedural_devirtualization): Add sanity check.
(try_make_edge_direct_virtual_call): Likewise.
From-SVN: r202837
* ipa-utils.h (method_class_type): Declare.
* ipa-devirt.c (method_class_type): Export.
* cgraphunit.c (analyze_functions): Do basic devirtualization;
do not walk base classes of anonymous types.
From-SVN: r201944
* ipa-utils.h (update_type_inheritance_graph): Declare.
(possible_polymorphic_call_target_p): Declare.
(possible_polymorphic_call_target_p): New.
* ipa-devirt.c: Update toplevel comments.
(cached_polymorphic_call_targets): Move up.
(odr_type_d): Move ID down.
(polymorphic_type_binfo_p): Update comment.
(odr_hasher::remove): Likewise;
(get_odr_type): Set anonymous_namespace.
(dump_odr_type): Dump it.
(dump_type_inheritance_graph): Do not ICE when there are no ODR types.
(maybe_record_node): Record node in cached_polymorphic_call_targets.
(record_binfo): Add comment.
(free_polymorphic_call_targets_hash): Do not ICE when cache is not built.
(devirt_node_removal_hook): Do not iCE when cache is freed.
(possible_polymorphic_call_target_p): New predicate.
(update_type_inheritance_graph): New function.
From-SVN: r201917
* ipa-pure-const.c (state_from_flags, local_pure_const): Use
current_function_name instead of lang_hooks.decl_printable_name.
* function.h (fndecl_name): New prototype.
* function.c (fndecl_name): New function.
* vecir.h (cgraph_node_p): New standard IR VEC type.
* trans-mem.c (cgraph_node_p): No need anymore to define it here.
* ipa-utils.h (ipa_get_nodes_in_cycle): New prototype.
* ipa-utils.c (ipa_get_nodes_in_cycle): New function.
* ipa-reference.c: Don't include langhooks.h, and certainly not twice.
Fix many formatting issues (long lines, short lines, spacing, etc.).
(get_static_name): Use fndecl_name.
(dump_static_vars_set_to_file): New function split out from propagate.
(union_static_var_sets): New function, union two sets and collapse
to all_module_statics as quickly as possible.
(intersect_static_var_sets): New function, similar to above.
(copy_static_var_set): Renamed from copy_global_bitmap and rewritten
to allocate a copy on the same bitmap_obstack as the source set.
(propagate_bits): Simplify, and clarify by using union_static_var_sets.
(generate_summary): Remove bm_temp. Print UID of promotable globals.
(read_write_all_from_decl): Use pass-by-reference, bless C++.
(get_read_write_all_from_node): New function, split out from propagate.
(propagate): Simplify and clarify with helper functions. Use
ipa_get_nodes_in_cycle to walk all nodes in a reduced node.
(ipa_reference_read_optimization_summary): Use fndecl_name instead of
lang_hooks.decl_printable_name.
* rtl.h (print_rtl_single_with_indent): New prototype.
* print-rtl.c (print_rtl_single_with_indent): New function.
* cfghooks.h (empty_block_p, split_block_before_cond_jump): New hooks.
* cfghooks.c (empty_block_p, split_block_before_cond_jump): Implement.
* cfgrtl.c (rtl_block_empty_p, rtl_split_block_before_cond_jump):
Implement RTL specific hooks.
(rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks): Register the new hooks.
* tree-cfg.c (gimple_empty_block_p,
gimple_split_block_before_cond_jump): Implement GIMPLE specific hooks.
(gimple_cfg_hooks): Register the new hooks.
* tree-ssa-phiopt.c (empty_block_p): Remove in favor of new hook.
From-SVN: r191255