Commit Graph

200 Commits

Author SHA1 Message Date
Aldy Hernandez 00de328a7a cgraph.h, [...]: Rename all instances of DECL_ABSTRACT to DECL_ABSTRACT_P.
* cgraph.h, dbxout.c, dwarfout2.c, gimple-fold.c,
    	lto-streamer-out.c, print-tree.c, symtab.c, tree-inline.c,
    	tree-streamer-in.c, tree-streamer-out.c, tree.c, tree.h,
    	varpool.c: Rename all instances of DECL_ABSTRACT to
    	DECL_ABSTRACT_P.

    cp/
    	* class.c, decl.c, optimize.c: Rename all instances of
    	DECL_ABSTRACT to DECL_ABSTRACT_P.

    lto/
    	* lto-symtab.c, lto.c: Rename all instances of DECL_ABSTRACT to
    	DECL_ABSTRACT_P.

From-SVN: r215567
2014-09-24 19:50:24 +00:00
Jan Hubicka 6f8091fc3e ipa-utils.h (ipa_polymorphic_call_context): Turn into class; add ctors.
* ipa-utils.h (ipa_polymorphic_call_context): Turn into class; add ctors.
	(possible_polymorphic_call_targets, dump_possible_polymorphic_call_targets,
	possible_polymorphic_call_target_p, possible_polymorphic_call_target_p): Simplify.
	(get_dynamic_type): Remove.
	* ipa-devirt.c (ipa_dummy_polymorphic_call_context): Remove.
	(clear_speculation): Bring to ipa-deivrt.h
	(get_class_context): Rename to ...
	(ipa_polymorphic_call_context::restrict_to_inner_class): ... this one.
	(contains_type_p): Update.
	(get_dynamic_type): Rename to ...
	ipa_polymorphic_call_context::get_dynamic_type(): ... this one.
	(possible_polymorphic_call_targets): UPdate.
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Update.
	* ipa-prop.c (ipa_analyze_call_uses): Update.

From-SVN: r215418
2014-09-20 06:22:58 +00:00
Richard Biener 2813904b11 re PR middle-end/63237 (error: invalid operand in unary operation)
2014-09-12  Richard Biener  <rguenther@suse.de>

	PR middle-end/63237
	* gimple-fold.c (get_maxval_strlen): Gimplify string length.

	* g++.dg/torture/pr63237.C: New testcase.

From-SVN: r215212
2014-09-12 11:06:49 +00:00
Richard Biener 1579e1f8ad re PR middle-end/62292 (FAIL: (geterrorname|getmethodname) run)
2014-08-29  Richard Biener  <rguenther@suse.de>

	PR middle-end/62292
	* gimple-fold.c (gimple_fold_builtin_strcpy): Fix error
	from previous refactoring.
	(gimple_fold_builtin_strncpy): Likewise.

From-SVN: r214716
2014-08-29 08:11:57 +00:00
Richard Biener dcb7fae249 gimple-fold.c (get_maxval_strlen): Add overload wrapping get_maxval_strlen inside a more useful API.
2014-08-27  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (get_maxval_strlen): Add overload wrapping
	get_maxval_strlen inside a more useful API.
	(gimple_fold_builtin_with_strlen): Remove and fold into ...
	(gimple_fold_builtin): ... caller.
	(gimple_fold_builtin_strlen, gimple_fold_builtin_strcpy,
	gimple_fold_builtin_strncpy, gimple_fold_builtin_strcat,
	gimple_fold_builtin_fputs, gimple_fold_builtin_memory_chk,
	gimple_fold_builtin_stxcpy_chk, gimple_fold_builtin_stxncpy_chk,
	gimple_fold_builtin_snprintf_chk, gimple_fold_builtin_snprintf,
	gimple_fold_builtin_sprintf): Adjust to compute maxval
	themselves.

From-SVN: r214574
2014-08-27 12:48:23 +00:00
Richard Biener 07f1cf564b re PR lto/62239 (ICE: in execute_todo, at passes.c:1795 with LTO)
2014-08-27  Richard Biener  <rguenther@suse.de>

	PR middle-end/62239
	* builtins.c (fold_builtin_strcat_chk): Move to gimple-fold.c.
	(fold_builtin_3): Do not fold strcat_chk here.
	* gimple-fold.c (gimple_fold_builtin_strcat_chk): Move here
	from builtins.c.
	(gimple_fold_builtin): Fold strcat_chk here.

From-SVN: r214564
2014-08-27 08:01:25 +00:00
Martin Liska 3dafb85c8e IPA C++ refactoring 4/N
* cgraph.h (symtab_node):
	(bool needed_p (void)): created from decide_is_symbol_needed
	(bool referred_to_p (void)): created from referred_to_p
	(static cgraph_node *get_for_asmname (tree asmname)): created from symtab_node_for_asm
	* cgraph.h (cgraph_node):
	(void assemble_thunks_and_aliases (void)): created from assemble_thunks_and_aliases
	(void expand (void)): created from expand_function
	(static void finalize_function (tree, bool)): created from cgraph_finalize_function
	(static cgraph_local_info *local_info (tree decl)): created from cgraph_local_info
	(static cgraph_global_info *global_info (tree)): created from cgraph_global_info
	(static cgraph_rtl_info *rtl_info (tree)): created from cgraph_rtl_info
	* cgraph.h (varpool_node):
	(static void add (tree decl): created from varpool_add_new_variable
	* cgraph.h (cgraph_edge):
	void remove (void);
	(void remove_caller (void)): created from cgraph_edge_remove_caller
	(void remove_callee (void)): created from cgraph_edge_remove_callee
	(void set_call_stmt (gimple new_stmt, bool update_speculative = true)):
	  created from cgraph_set_call_stmt	
	(void redirect_callee (cgraph_node *n)): created from cgraph_redirect_edge_callee
	(cgraph_edge *make_direct (cgraph_node *callee)): created from cgraph_make_edge_direct
	(cgraph_edge *make_speculative (cgraph_node *n2, gcov_type direct_count,
	  gimple redirect_call_stmt_to_callee (void)): created from cgraph_turn_edge_to_speculative
	(void speculative_call_info (cgraph_edge *&direct, cgraph_edge *&indirect, ipa_ref *&reference)):
	  created from cgraph_speculative_call_info
	(cgraph_edge * clone (cgraph_node *n, gimple call_stmt, unsigned stmt_uid, gcov_type count_scale,
	  int freq_scale, bool update_original)): created from cgraph_clone_edge
	(cgraph_edge *resolve_speculation (tree callee_decl)): created from cgraph_resolve_speculation
	(bool cannot_lead_to_return_p (void)): created from cannot_lead_to_return_p
	(bool recursive_p (void)): created from cgraph_edge_recursive_p
	(bool maybe_hot_p (void)): created from cgraph_maybe_hot_edge_p
	(static unsigned int rebuild_edges (void)): created from rebuild_cgraph_edges 
	(static void rebuild_references (void)): created from cgraph_rebuild_references
	* cgraph.h (symbol_table):
	(create_reference): renamed from add_reference
	(maybe_create_reference): renamed from maybe_add_reference
	(void register_symbol (symtab_node *node)): new function
	(void clear_asm_symbols (void)): new function
	(void unregister (symtab_node *node)): new function
	(void release_symbol (cgraph_node *node, int uid)): new function
	(cgraph_node * allocate_cgraph_symbol (void)): new function
	(void initialize (void)): created from cgraph_init
	(symtab_node *first_symbol (void)):new function
	(asm_node *first_asm_symbol (void)):new function
	(symtab_node *first_defined_symbol (void)):new function
	(varpool_node *first_variable (void)):new function
	(varpool_node *next_variable (varpool_node *node)):new function
	(varpool_node *first_static_initializer (void)):new function
	(varpool_node *next_static_initializer (varpool_node *node)):new function
	(varpool_node *first_defined_variable (void)):new function
	(varpool_node *next_defined_variable (varpool_node *node)):new function
	(cgraph_node *first_defined_function (void)):new function
	(cgraph_node *next_defined_function (cgraph_node *node)):new function
	(cgraph_node *first_function (void)):new function
	(cgraph_node *next_function (cgraph_node *node)):new function
	(cgraph_node *first_function_with_gimple_body (void)):new function
	(asm_node *finalize_toplevel_asm (tree asm_str)): created from add_asm_node
	(bool remove_unreachable_nodes (bool before_inlining_p, FILE *file)):
	  created from symtab_remove_unreachable_nodes
	(void remove_unreferenced_decls (void)): created from varpool_remove_unreferenced_decls
	(void process_new_functions (void)): created from cgraph_process_new_functions
	(void process_same_body_aliases (void)): created from cgraph_process_same_body_aliases
	(bool output_variables (void)): created from varpool_node::output_variables
	(void output_asm_statements (void)): created from output_asm_statements
	(void finalize_compilation_unit (void)): created from finalize_compilation_unit
	(void compile (void)): created from compile
	(void output_weakrefs (void)): created from output_weakrefs
	(cgraph_node *create_empty (void)): created from cgraph_node::create_empty
	(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_node::create_edge
	(void free_edge (cgraph_edge *e)): created from cgraph_free_edge
	(cgraph_node *next_function_with_gimple_body (cgraph_node *node)):
	  created from cgraph_next_function_with_gimple_body
	(void remove_edge_removal_hook (cgraph_edge_hook_list *)):
	  created from cgraph_remove_edge_removal_hook
	(cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook, void *)):
	  created from cgraph_add_node_removal_hook
	(void remove_cgraph_removal_hook (cgraph_node_hook_list *)):
	  created from cgraph_remove_node_removal_hook
	(varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook, void *)):
	  created from varpool_add_node_removal_hook
	(void remove_varpool_removal_hook (varpool_node_hook_list *)):
	  created from varpool_remove_node_removal_hook
	(cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook, void *)):
	  created from cgraph_add_function_insertion_hook
	(void remove_cgraph_insertion_hook (cgraph_node_hook_list *)):
	  created from cgraph_remove_function_insertion_hook
	(varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook, void *)):
	  created from varpool_add_variable_insertion_hook
	(void remove_varpool_insertion_hook (varpool_node_hook_list *)):
	  created from varpool_remove_variable_insertion_hook
	(cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook, void *)):
	  created from cgraph_add_edge_duplication_hook
	(void remove_edge_duplication_hook (cgraph_2edge_hook_list *)):
	  created from cgraph_remove_edge_duplication_hook
	(cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook, void *)):
	  created from cgraph_add_node_duplication_hook
	(void remove_cgraph_duplication_hook (cgraph_2node_hook_list *)):
	  created from cgraph_remove_node_duplication_hook
	(void call_edge_removal_hooks (cgraph_edge *e)):
	  created from cgraph_call_edge_removal_hooks
	(void call_cgraph_insertion_hooks (cgraph_node *node)):
	  created from call_function_insertion_hooks 
	(void call_cgraph_removal_hooks (cgraph_node *node)):
	  created from cgraph_call_node_removal_hooks 
	(void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2)):
	  created from cgraph_node::call_duplication_hooks 
	(void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2)):
	  created from cgraph_call_edge_duplication_hooks
	(void call_varpool_removal_hooks (varpool_node *node)):
	  created from varpool_call_node_removal_hooks
	(void call_varpool_insertion_hooks (varpool_node *node)):
	  created from varpool_call_variable_insertion_hooks
	(void insert_to_assembler_name_hash (symtab_node *node, bool with_clones)):
	  created from insert_to_assembler_name_hash
	(void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)):
	  created from unlink_from_assembler_name_hash
	(void symtab_prevail_in_asm_name_hash (symtab_node *node)):
	  created from symtab_prevail_in_asm_name_hash
	(void symtab_initialize_asm_name_hash (void)):
	  created from symtab_initialize_asm_name_hash
	(void change_decl_assembler_name (tree decl, tree name)):
	  created from change_decl_assembler_name
	(void materialize_all_clones (void)): created from cgraph_materialize_all_clones
	(static hashval_t decl_assembler_name_hash (const_tree asmname)):
	  created from decl_assembler_name_hash
	(static bool decl_assembler_name_equal (tree decl, const_tree asmname)):
	  created from decl_assembler_name_equal
	(static hashval_t hash_node_by_assembler_name (const void *p)):
	  created from hash_node_by_assembler_name
	(static int eq_assembler_name (const void *p1, const void *p2)):
	  created from eq_assembler_name

From-SVN: r214422
2014-08-25 13:01:47 +00:00
Richard Biener 3ef276e442 gimple-fold.c (fold_gimple_assign): Properly build a null-pointer constant when devirtualizing addresses.
2014-08-19  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (fold_gimple_assign): Properly build a
	null-pointer constant when devirtualizing addresses.

From-SVN: r214141
2014-08-19 11:19:52 +00:00
Jan Hubicka c5ac1780e4 gimple-fold.c (fold_gimple_assign): Do not intorudce referneces to BUILT_IN_UNREACHABLE.
* gimple-fold.c (fold_gimple_assign): Do not intorudce referneces
	to BUILT_IN_UNREACHABLE.

From-SVN: r214114
2014-08-18 19:21:12 +00:00
Richard Biener d7e7844708 re PR middle-end/62090 (ice in compute_may_aliases)
2014-08-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/62090
	* builtins.c (fold_builtin_snprintf): Move to gimple-fold.c.
	(fold_builtin_3): Do not fold snprintf.
	(fold_builtin_4): Likewise.
	* gimple-fold.c (gimple_fold_builtin_snprintf): New function
	moved from builtins.c.
	(gimple_fold_builtin_with_strlen): Fold snprintf and sprintf.
	(gimple_fold_builtin): Do not fold sprintf here.

	* gcc.dg/pr62090-2.c: New testcase.

From-SVN: r214105
2014-08-18 14:51:04 +00:00
Richard Biener 040292e700 gimple-fold.c (maybe_fold_reference): Move re-gimplification code to ...
2014-08-18  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (maybe_fold_reference): Move re-gimplification
	code to ...
	(maybe_canonicalize_mem_ref_addr): ... this function.
	(fold_stmt_1): Apply it here before all simplification.

From-SVN: r214103
2014-08-18 14:30:30 +00:00
Richard Biener 35770bb20f re PR middle-end/62090 (ice in compute_may_aliases)
2014-08-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/62090
	* builtins.c (fold_builtin_sprintf): Move to gimple-fold.c.
	(fold_builtin_2): Do not fold sprintf.
	(fold_builtin_3): Likewise.
	* gimple-fold.c (gimple_fold_builtin_sprintf): New function
	moved from builtins.c.
	(gimple_fold_builtin): Fold sprintf.

	* gcc.dg/pr62090.c: New testcase.

From-SVN: r213951
2014-08-14 09:02:18 +00:00
Thomas Preud'homme 3d8208ce68 re PR middle-end/62103 (Incorrect folding of bitfield in a union on big endian targets)
2014-08-12  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    PR middle-end/62103
    * gimple-fold.c (fold_ctor_reference): Don't fold in presence of
    bitfields, that is when size doesn't match the size of type or the
    size of the constructor.

    gcc/testsuite/
    PR middle-end/62103
    * gcc.c-torture/execute/bitfld-6.c: New test.

From-SVN: r213846
2014-08-12 02:36:37 +00:00
Richard Biener fef5a0d95e builtins.c (c_getstr, [...]): Export.
2014-08-08  Richard Biener  <rguenther@suse.de>

	* builtins.c (c_getstr, readonly_data_expr, init_target_chars,
	target_percent, target_percent_s): Export.
	(var_decl_component_p, fold_builtin_memory_op, fold_builtin_memset,
	fold_builtin_bzero, fold_builtin_strcpy, fold_builtin_strncpy,
	fold_builtin_strcat, fold_builtin_fputs, fold_builtin_memory_chk,
	fold_builtin_stxcpy_chk, fold_builtin_stxncpy_chk,
	fold_builtin_sprintf_chk_1, fold_builtin_snprintf_chk_1):
	Move to gimple-fold.c.
	(fold_builtin_2): Remove handling of bzero, fputs, fputs_unlocked,
	strcat and strcpy.
	(fold_builtin_3): Remove handling of memset, bcopy, memcpy,
	mempcpy, memmove, strncpy, strcpy_chk and stpcpy_chk.
	(fold_builtin_4): Remove handling of memcpy_chk, mempcpy_chk,
	memmove_chk, memset_chk, strncpy_chk and stpncpy_chk.
	(rewrite_call_expr_array): Remove.
	(fold_builtin_sprintf_chk): Likewise.
	(fold_builtin_snprintf_chk): Likewise.
	(fold_builtin_varargs): Remove handling of sprintf_chk,
	vsprintf_chk, snprintf_chk and vsnprintf_chk.
	(gimple_fold_builtin_sprintf_chk): Remove.
	(gimple_fold_builtin_snprintf_chk): Likewise.
	(gimple_fold_builtin_varargs): Likewise.
	(fold_call_stmt): Do not call gimple_fold_builtin_varargs.
	* predict.c (optimize_bb_for_size_p): Handle NULL bb.
	* gimple.c (gimple_seq_add_seq_without_update): New function.
	* gimple.h (gimple_seq_add_seq_without_update): Declare.
	* gimple-fold.c: Include output.h.
	(gsi_replace_with_seq_vops): New function, split out from ...
	(gimplify_and_update_call_from_tree): ... here.
	(replace_call_with_value): New function.
	(replace_call_with_call_and_fold): Likewise.
	(var_decl_component_p): Moved from builtins.c.
	(gimple_fold_builtin_memory_op): Moved from builtins.c
	fold_builtin_memory_op and rewritten to GIMPLE.
	(gimple_fold_builtin_memset): Likewise.
	(gimple_fold_builtin_strcpy): Likewise.
	(gimple_fold_builtin_strncpy): Likewise.
	(gimple_fold_builtin_strcat): Likewise.
	(gimple_fold_builtin_fputs): Likewise.
	(gimple_fold_builtin_memory_chk): Likewise.
	(gimple_fold_builtin_stxcpy_chk): Likewise.
	(gimple_fold_builtin_stxncpy_chk): Likewise.
	(gimple_fold_builtin_snprintf_chk): Likewise.
	(gimple_fold_builtin_sprintf_chk): Likewise.
	(gimple_fold_builtin_strlen): New function.
	(gimple_fold_builtin_with_strlen): New function split out from
	gimple_fold_builtin.
	(gimple_fold_builtin): Change signature and handle
	bzero, memset, bcopy, memcpy, mempcpy and memmove folding
	here.  Call gimple_fold_builtin_with_strlen.
	(gimple_fold_call): Adjust.

	* gcc.dg/strlenopt-8.c: Remove XFAIL.
	* gcc.dg/tree-prof/stringop-2.c: Adjust.
	* gfortran.dg/array_memcpy_4.f90: Likewise.
	* gfortran.dg/trim_optimize_1.f90: Likewise.
	* gfortran.dg/trim_optimize_2.f90: Likewise.

From-SVN: r213753
2014-08-08 09:18:40 +00:00
Richard Biener 3daa26d0e9 gimple-fold.h (gimple_fold_builtin): Remove.
2014-08-04  Richard Biener  <rguenther@suse.de>

	* gimple-fold.h (gimple_fold_builtin): Remove.
	* gimple-fold.c (gimple_fold_builtin): Make static.
	* tree-ssa-ccp.c (pass_fold_builtins::execute): Use
	fold_stmt, not gimple_fold_builtin.

From-SVN: r213585
2014-08-04 13:08:34 +00:00
Jan Hubicka f8a39967a5 gimple-fold.c (fold_gimple_assign): Fix condition guarding ipa-devirt path; fix thinko there.
* gimple-fold.c (fold_gimple_assign): Fix condition guarding
	ipa-devirt path; fix thinko there.

From-SVN: r213150
2014-07-29 09:36:36 +00:00
Richard Biener b250514336 re PR middle-end/61762 (failure to optimize memcpy from constant string)
2014-07-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/61762
	PR middle-end/61894
	* fold-const.c (native_encode_int): Add and handle offset
	parameter to do partial encodings of expr.
	(native_encode_fixed): Likewise.
	(native_encode_real): Likewise.
	(native_encode_complex): Likewise.
	(native_encode_vector): Likewise.
	(native_encode_string): Likewise.
	(native_encode_expr): Likewise.
	* fold-const.c (native_encode_expr): Add offset parameter
	defaulting to -1.
	* gimple-fold.c (fold_string_cst_ctor_reference): Remove.
	(fold_ctor_reference): Handle all reads from tcc_constant
	ctors.

	* gcc.dg/pr61762.c: New testcase.
	* gcc.dg/fold-cstring.c: Likewise.
	* gcc.dg/fold-cvect.c: Likewise.

From-SVN: r213045
2014-07-25 07:44:57 +00:00
Martin Liska 9041d2e6d2 IPA C++ refactoring 2/N
* cgraph.h (varpool_node):
  (availability get_availability (void)):
    created from cgraph_variable_initializer_availability
  (inline varpool_node *ultimate_alias_target (availability *availability = NULL)
    creted from: cgraph_variable_initializer_availability
  (inline varpool_node *get_alias_target (void)): created from varpool_alias_target
  (void finalize_named_section_flags (void)):
    created from varpool_finalize_named_section_flags
  (bool assemble_decl (void)): created from varpool_assemble_decl
  (void analyze (void)): created from varpool_analyze_node
  (bool call_for_node_and_aliases (bool (*callback) (varpool_node *, void *),
    void *data, bool include_overwritable)): created fromvarpool_for_node_and_aliases
  (void remove_initializer (void)): created from varpool_remove_initializer
  (tree get_constructor (void)): created from varpool_get_constructor
  (bool externally_visible_p (void)): created from varpool_externally_visible_p
  (bool ctor_useable_for_folding_p (void)): created from varpool_ctor_useable_for_folding_p
  (inline bool all_refs_explicit_p ()): created from varpool_all_refs_explicit_p
  (inline bool can_remove_if_no_refs_p (void)): created from varpool_can_remove_if_no_refs
  (static inline varpool_node *get (const_tree decl)): created from varpool_get_node
  (static void finalize_decl (tree decl)): created from varpool_finalize_decl
  (static bool output_variables (void)): created from varpool_output_variables
  (static varpool_node * create_extra_name_alias (tree alias, tree decl)):
    created from varpool_extra_name_alias
  (static varpool_node * create_alias (tree, tree)): created from varpool_create_variable_alias
  (static void dump_varpool (FILE *f)): created from dump_varpool
  (static void DEBUG_FUNCTION debug_varpool (void)): created from debug_varpool
  (static varpool_node *create_empty (void)): created from varpool_create_empty_node
  (static varpool_node *get_create (tree decl)): created from varpool_node_for_decl
  (static varpool_node *get_for_asmname (tree asmname)): created from varpool_node_for_asm
  (void assemble_aliases (void)): created from assemble_aliases

From-SVN: r212984
2014-07-24 12:25:27 +00:00
Martin Liska d52f529517 IPA C++ refactoring 1/N
* 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
2014-07-24 12:07:13 +00:00
Jan Hubicka 058d0a9059 cgraph.c (cgraph_create_indirect_edge): Update call of get_polymorphic_call_info.
* 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
2014-07-05 17:22:44 +00:00
Martin Liska 807b7d6209 Fix for devirtualization dump functions
* gimple.h (gimple_location_safe): New function introduced.
	* cgraphunit.c (walk_polymorphic_call_targets): Usage
	of gimple_location_safe replaces gimple_location.
	(gimple_fold_call): Likewise.
	* ipa-devirt.c (ipa_devirt): Likewise.
	* ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.
	* ipa.c (walk_polymorphic_call_targets): Likewise.
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Likewise.

From-SVN: r212067
2014-06-27 09:24:45 +00:00
Andrew MacLeod 9b2b72791e expr.h: Remove prototypes of functions defined in builtins.c.
* expr.h: Remove prototypes of functions defined in builtins.c.
	* tree.h: (build_call_expr_*, build_string_literal): Add prototypes.
	Remove prototypes of functions defined in builtins.c.
	* builtins.h: Update prototype list to include all exported functions.
	* builtins.c: (default_libc_has_function, gnu_libc_has_function,
	no_c99_libc_has_function): Move to targhooks.c
	(build_string_literal, build_call_expr_loc_array,
	build_call_expr_loc_vec, build_call_expr_loc, build_call_expr): Move
	to tree.c.
	(expand_builtin_object_size, fold_builtin_object_size): Make static.
	* targhooks.c (default_libc_has_function, gnu_libc_has_function,
	no_c99_libc_has_function): Relocate from builtins.c.
	* tree.c: Include builtins.h.
	(build_call_expr_loc_array, build_call_expr_loc_vec,
	build_call_expr_loc, build_call_expr, build_string_literal): Relocate
	from builtins.c.
	* fold-const.h (fold_fma): Move prototype to builtins.h.
	* realmpfr.h (do_mpc_arg2): Move prototype to builtins.h.

	* fortran/trans.c (trans_runtime_error_vararg): Call
	fold_build_call_array_loc instead of fold_builtin_call_array.

	* asan.c: Include builtins.h.
	* cfgexpand.c: Likewise.
	* convert.c: Likewise.
	* emit-rtl.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* fold-const.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-ssa-strength-reduction.c: Likewise.
	* gimplify.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* stmt.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-streamer-in.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-stmts.c: Likewise.

	c
	* c-decl.c: Include builtins.h.
	* c-parser.c: Likewise.

	cp
	* decl.c: Include builtins.h.
	* semantics.c: Likewise.

	go
	* go-gcc.cc: Include builtins.h.

	lto
	* lto-symtab.c: Include builtins.h.

	config
	* aarch64/aarch64.c: Include builtins.h.
	* alpha/alpha.c: Likewise.
	* arc/arc.c: Likewise.
	* arm/arm.c: Likewise.
	* avr/avr.c: Likewise.
	* bfin/bfin.c: Likewise.
	* c6x/c6x.c: Likewise.
	* cr16/cr16.c: Likewise.
	* cris/cris.c: Likewise.
	* epiphany/epiphany.c: Likewise.
	* fr30/fr30.c: Likewise.
	* frv/frv.c: Likewise.
	* h8300/h8300.c: Likewise.
	* i386/i386.c: Likewise.
	* i386/winnt.c: Likewise.
	* ia64/ia64.c: Likewise.
	* iq2000/iq2000.c: Likewise.
	* lm32/lm32.c: Likewise.
	* m32c/m32c.c: Likewise.
	* m32r/m32r.c: Likewise.
	* m68k/m68k.c: Likewise.
	* mcore/mcore.c: Likewise.
	* mep/mep.c: Likewise.
	* microblaze/microblaze.c: Likewise.
	* mips/mips.c: Likewise.
	* mmix/mmix.c: Likewise.
	* mn10300/mn10300.c: Likewise.
	* moxie/moxie.c: Likewise.
	* msp430/msp430.c: Likewise.
	* nds32/nds32.c: Likewise.
	* pa/pa.c: Likewise.
	* pdp11/pdp11.c: Likewise.
	* picochip/picochip.c: Likewise.
	* rl78/rl78.c: Likewise.
	* rs6000/rs6000.c: Likewise.
	* rx/rx.c: Likewise.
	* s390/s390.c: Likewise.
	* score/score.c: Likewise.
	* sh/sh.c: Likewise.
	* sparc/sparc.c: Likewise.
	* spu/spu.c: Likewise.
	* stormy16/stormy16.c: Likewise.
	* tilegx/tilegx.c: Likewise.
	* tilepro/tilepro.c: Likewise.
	* v850/v850.c: Likewise.
	* vax/vax.c: Likewise.
	* xtensa/xtensa.c: Likewise.

From-SVN: r211145
2014-06-02 20:13:44 +00:00
Jan Hubicka 6adda80bb2 gimple-fold.c (can_refer_decl_in_current_unit_p): Be sure that var decl is available.
* gimple-fold.c (can_refer_decl_in_current_unit_p): Be sure
	that var decl is available.

From-SVN: r210902
2014-05-24 22:02:13 +00:00
Jan Hubicka 3aaf05290a re PR tree-optimization/60899 (undef reference generated with -fdevirtualize-speculatively)
PR tree-optimization/60899
	* gimple-fold.c (can_refer_decl_in_current_unit_p): Cleanup;
	assume all static symbols will have definition wile parsing and
	check the do have definition later in compilation; check that
	variable referring symbol will be output before concluding that
	reference is safe; be conservative for referring local statics;
	be more precise about when comdat is output in other partition.

	g++.dg/ipa/devirt-11.C: Update template.

From-SVN: r210676
2014-05-21 06:16:03 +00:00
Xinliang David Li 2b5f089527 add dbgcnt support for devirt
From-SVN: r210657
2014-05-20 20:12:22 +00:00
Richard Biener fb42e303b4 gimple-fold.c (gimple_fold_stmt_to_constant_1): Remove pointer propagation special-case.
2014-05-08  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Remove
	pointer propagation special-case.

From-SVN: r210208
2014-05-08 10:19:17 +00:00
Kenneth Zadeck 807e902eea Merge in wide-int.
From-SVN: r210113
2014-05-06 16:25:05 +00:00
David Malcolm 7de90a6c27 Change is-a.h to support typedefs of pointers
gcc/
	* is-a.h: Update comments to reflect the following changes to the
	"pointerness" of the API, making the template parameter match the
	return type, allowing use of is-a.h with typedefs of pointers.
	(is_a_helper::cast): Return a T rather then a pointer to a T, so
	that the return type matches the parameter to the is_a_helper.
	(as_a): Likewise.
	(dyn_cast): Likewise.

	* cgraph.c (cgraph_node_for_asm): Update for removal of implicit
	pointer from the is-a.h API.

	* cgraph.h (is_a_helper <cgraph_node>::test): Convert to...
	(is_a_helper <cgraph_node *>::test): ...this, matching change to
	is-a.h API.
	(is_a_helper <varpool_node>::test): Likewise, convert to...
	(is_a_helper <varpool_node *>::test): ...this.

	(varpool_first_variable): Update for removal of implicit pointer
	from the is-a.h API.
	(varpool_next_variable): Likewise.
	(varpool_first_static_initializer): Likewise.
	(varpool_next_static_initializer): Likewise.
	(varpool_first_defined_variable): Likewise.
	(varpool_next_defined_variable): Likewise.
	(cgraph_first_defined_function): Likewise.
	(cgraph_next_defined_function): Likewise.
	(cgraph_first_function): Likewise.
	(cgraph_next_function): Likewise.
	(cgraph_first_function_with_gimple_body): Likewise.
	(cgraph_next_function_with_gimple_body): Likewise.
	(cgraph_alias_target): Likewise.
	(varpool_alias_target): Likewise.
	(cgraph_function_or_thunk_node): Likewise.
	(varpool_variable_node): Likewise.
	(symtab_real_symbol_p): Likewise.
	* cgraphunit.c (referred_to_p): Likewise.
	(analyze_functions): Likewise.
	(handle_alias_pairs): Likewise.
	* gimple-fold.c (can_refer_decl_in_current_unit_p): Likewise.
	* gimple-ssa.h (gimple_vuse_op): Likewise.
	(gimple_vdef_op): Likewise.
	* gimple-streamer-in.c (input_gimple_stmt): Likewise.
	* gimple.c (gimple_build_asm_1): Likewise.
	(gimple_build_try): Likewise.
	(gimple_build_resx): Likewise.
	(gimple_build_eh_dispatch): Likewise.
	(gimple_build_omp_for): Likewise.
	(gimple_omp_for_set_clauses): Likewise.

	* gimple.h (is_a_helper <gimple_statement_asm>::test): Convert to...
	(is_a_helper <gimple_statement_asm *>::test): ...this.
	(is_a_helper <gimple_statement_bind>::test): Convert to...
	(is_a_helper <gimple_statement_bind *>::test): ...this.
	(is_a_helper <gimple_statement_call>::test): Convert to...
	(is_a_helper <gimple_statement_call *>::test): ...this.
	(is_a_helper <gimple_statement_catch>::test): Convert to...
	(is_a_helper <gimple_statement_catch *>::test): ...this.
	(is_a_helper <gimple_statement_resx>::test): Convert to...
	(is_a_helper <gimple_statement_resx *>::test): ...this.
	(is_a_helper <gimple_statement_eh_dispatch>::test): Convert to...
	(is_a_helper <gimple_statement_eh_dispatch *>::test): ...this.
	(is_a_helper <gimple_statement_eh_else>::test): Convert to...
	(is_a_helper <gimple_statement_eh_else *>::test): ...this.
	(is_a_helper <gimple_statement_eh_filter>::test): Convert to...
	(is_a_helper <gimple_statement_eh_filter *>::test): ...this.
	(is_a_helper <gimple_statement_eh_mnt>::test): Convert to...
	(is_a_helper <gimple_statement_eh_mnt *>::test): ...this.
	(is_a_helper <gimple_statement_omp_atomic_load>::test): Convert to...
	(is_a_helper <gimple_statement_omp_atomic_load *>::test): ...this.
	(is_a_helper <gimple_statement_omp_atomic_store>::test): Convert to...
	(is_a_helper <gimple_statement_omp_atomic_store *>::test): ...this.
	(is_a_helper <gimple_statement_omp_return>::test): Convert to...
	(is_a_helper <gimple_statement_omp_return *>::test): ...this.
	(is_a_helper <gimple_statement_omp_continue>::test): Convert to...
	(is_a_helper <gimple_statement_omp_continue *>::test): ...this.
	(is_a_helper <gimple_statement_omp_critical>::test): Convert to...
	(is_a_helper <gimple_statement_omp_critical *>::test): ...this.
	(is_a_helper <gimple_statement_omp_for>::test): Convert to...
	(is_a_helper <gimple_statement_omp_for *>::test): ...this.
	(is_a_helper <gimple_statement_omp_taskreg>::test): Convert to...
	(is_a_helper <gimple_statement_omp_taskreg *>::test): ...this.
	(is_a_helper <gimple_statement_omp_parallel>::test): Convert to...
	(is_a_helper <gimple_statement_omp_parallel *>::test): ...this.
	(is_a_helper <gimple_statement_omp_target>::test): Convert to...
	(is_a_helper <gimple_statement_omp_target *>::test): ...this.
	(is_a_helper <gimple_statement_omp_sections>::test): Convert to...
	(is_a_helper <gimple_statement_omp_sections *>::test): ...this.
	(is_a_helper <gimple_statement_omp_single>::test): Convert to...
	(is_a_helper <gimple_statement_omp_single *>::test): ...this.
	(is_a_helper <gimple_statement_omp_teams>::test): Convert to...
	(is_a_helper <gimple_statement_omp_teams *>::test): ...this.
	(is_a_helper <gimple_statement_omp_task>::test): Convert to...
	(is_a_helper <gimple_statement_omp_task *>::test): ...this.
	(is_a_helper <gimple_statement_phi>::test): Convert to...
	(is_a_helper <gimple_statement_phi *>::test): ...this.
	(is_a_helper <gimple_statement_transaction>::test): Convert to...
	(is_a_helper <gimple_statement_transaction *>::test): ...this.
	(is_a_helper <gimple_statement_try>::test): Convert to...
	(is_a_helper <gimple_statement_try *>::test): ...this.
	(is_a_helper <gimple_statement_wce>::test): Convert to...
	(is_a_helper <gimple_statement_wce *>::test): ...this.
	(is_a_helper <const gimple_statement_asm>::test): Convert to...
	(is_a_helper <const gimple_statement_asm *>::test): ...this.
	(is_a_helper <const gimple_statement_bind>::test): Convert to...
	(is_a_helper <const gimple_statement_bind *>::test): ...this.
	(is_a_helper <const gimple_statement_call>::test): Convert to...
	(is_a_helper <const gimple_statement_call *>::test): ...this.
	(is_a_helper <const gimple_statement_catch>::test): Convert to...
	(is_a_helper <const gimple_statement_catch *>::test): ...this.
	(is_a_helper <const gimple_statement_resx>::test): Convert to...
	(is_a_helper <const gimple_statement_resx *>::test): ...this.
	(is_a_helper <const gimple_statement_eh_dispatch>::test):
	Convert to...
	(is_a_helper <const gimple_statement_eh_dispatch *>::test):
	...this.
	(is_a_helper <const gimple_statement_eh_filter>::test): Convert
	to...
	(is_a_helper <const gimple_statement_eh_filter *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_atomic_load>::test):
	Convert to...
	(is_a_helper <const gimple_statement_omp_atomic_load *>::test):
	...this.
	(is_a_helper <const gimple_statement_omp_atomic_store>::test):
	Convert to...
	(is_a_helper <const gimple_statement_omp_atomic_store *>::test):
	...this.
	(is_a_helper <const gimple_statement_omp_return>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_return *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_continue>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_continue *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_critical>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_critical *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_for>::test): Convert to...
	(is_a_helper <const gimple_statement_omp_for *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_taskreg>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_taskreg *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_parallel>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_parallel *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_target>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_target *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_sections>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_sections *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_single>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_single *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_teams>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_teams *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_task>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_task *>::test): ...this.
	(is_a_helper <const gimple_statement_phi>::test): Convert to...
	(is_a_helper <const gimple_statement_phi *>::test): ...this.
	(is_a_helper <const gimple_statement_transaction>::test): Convert
	to...
	(is_a_helper <const gimple_statement_transaction *>::test): ...this.
	(is_a_helper <const gimple_statement_with_ops>::test): Convert
	to...
	(is_a_helper <const gimple_statement_with_ops *>::test): ...this.
	(is_a_helper <gimple_statement_with_ops>::test): Convert to...
	(is_a_helper <gimple_statement_with_ops *>::test): ...this.
	(is_a_helper <const gimple_statement_with_memory_ops>::test):
	Convert to...
	(is_a_helper <const gimple_statement_with_memory_ops *>::test):
	...this.
	(is_a_helper <gimple_statement_with_memory_ops>::test): Convert
	to...
	(is_a_helper <gimple_statement_with_memory_ops *>::test): ...this.

	(gimple_use_ops): Update for removal of implicit pointer from the
	is-a.h API.
	(gimple_set_use_ops): Likewise.
	(gimple_vuse): Likewise.
	(gimple_vdef): Likewise.
	(gimple_vuse_ptr): Likewise.
	(gimple_vdef_ptr): Likewise.
	(gimple_set_vuse): Likewise.
	(gimple_set_vdef): Likewise.
	(gimple_omp_return_set_lhs): Likewise.
	(gimple_omp_return_lhs): Likewise.
	(gimple_omp_return_lhs_ptr): Likewise.
	(gimple_call_fntype): Likewise.
	(gimple_call_set_fntype): Likewise.
	(gimple_call_set_internal_fn): Likewise.
	(gimple_call_use_set): Likewise.
	(gimple_call_clobber_set): Likewise.
	(gimple_bind_vars): Likewise.
	(gimple_bind_set_vars): Likewise.
	(gimple_bind_body_ptr): Likewise.
	(gimple_bind_set_body): Likewise.
	(gimple_bind_add_stmt): Likewise.
	(gimple_bind_block): Likewise.
	(gimple_bind_set_block): Likewise.
	(gimple_asm_ninputs): Likewise.
	(gimple_asm_noutputs): Likewise.
	(gimple_asm_nclobbers): Likewise.
	(gimple_asm_nlabels): Likewise.
	(gimple_asm_input_op): Likewise.
	(gimple_asm_input_op_ptr): Likewise.
	(gimple_asm_output_op): Likewise.
	(gimple_asm_output_op_ptr): Likewise.
	(gimple_asm_set_output_op): Likewise.
	(gimple_asm_clobber_op): Likewise.
	(gimple_asm_set_clobber_op): Likewise.
	(gimple_asm_label_op): Likewise.
	(gimple_asm_set_label_op): Likewise.
	(gimple_asm_string): Likewise.
	(gimple_catch_types): Likewise.
	(gimple_catch_types_ptr): Likewise.
	(gimple_catch_handler_ptr): Likewise.
	(gimple_catch_set_types): Likewise.
	(gimple_catch_set_handler): Likewise.
	(gimple_eh_filter_types): Likewise.
	(gimple_eh_filter_types_ptr): Likewise.
	(gimple_eh_filter_failure_ptr): Likewise.
	(gimple_eh_filter_set_types): Likewise.
	(gimple_eh_filter_set_failure): Likewise.
	(gimple_eh_must_not_throw_fndecl): Likewise.
	(gimple_eh_must_not_throw_set_fndecl): Likewise.
	(gimple_eh_else_n_body_ptr): Likewise.
	(gimple_eh_else_e_body_ptr): Likewise.
	(gimple_eh_else_set_n_body): Likewise.
	(gimple_eh_else_set_e_body): Likewise.
	(gimple_try_eval_ptr): Likewise.
	(gimple_try_cleanup_ptr): Likewise.
	(gimple_try_set_eval): Likewise.
	(gimple_try_set_cleanup): Likewise.
	(gimple_wce_cleanup_ptr): Likewise.
	(gimple_wce_set_cleanup): Likewise.
	(gimple_phi_capacity): Likewise.
	(gimple_phi_num_args): Likewise.
	(gimple_phi_result): Likewise.
	(gimple_phi_result_ptr): Likewise.
	(gimple_phi_set_result): Likewise.
	(gimple_phi_arg): Likewise.
	(gimple_phi_set_arg): Likewise.
	(gimple_resx_region): Likewise.
	(gimple_resx_set_region): Likewise.
	(gimple_eh_dispatch_region): Likewise.
	(gimple_eh_dispatch_set_region): Likewise.
	(gimple_omp_critical_name): Likewise.
	(gimple_omp_critical_name_ptr): Likewise.
	(gimple_omp_critical_set_name): Likewise.
	(gimple_omp_for_clauses): Likewise.
	(gimple_omp_for_clauses_ptr): Likewise.
	(gimple_omp_for_set_clauses): Likewise.
	(gimple_omp_for_collapse): Likewise.
	(gimple_omp_for_index): Likewise.
	(gimple_omp_for_index_ptr): Likewise.
	(gimple_omp_for_set_index): Likewise.
	(gimple_omp_for_initial): Likewise.
	(gimple_omp_for_initial_ptr): Likewise.
	(gimple_omp_for_set_initial): Likewise.
	(gimple_omp_for_final): Likewise.
	(gimple_omp_for_final_ptr): Likewise.
	(gimple_omp_for_set_final): Likewise.
	(gimple_omp_for_incr): Likewise.
	(gimple_omp_for_incr_ptr): Likewise.
	(gimple_omp_for_set_incr): Likewise.
	(gimple_omp_for_pre_body_ptr): Likewise.
	(gimple_omp_for_set_pre_body): Likewise.
	(gimple_omp_parallel_clauses): Likewise.
	(gimple_omp_parallel_clauses_ptr): Likewise.
	(gimple_omp_parallel_set_clauses): Likewise.
	(gimple_omp_parallel_child_fn): Likewise.
	(gimple_omp_parallel_child_fn_ptr): Likewise.
	(gimple_omp_parallel_set_child_fn): Likewise.
	(gimple_omp_parallel_data_arg): Likewise.
	(gimple_omp_parallel_data_arg_ptr): Likewise.
	(gimple_omp_parallel_set_data_arg): Likewise.
	(gimple_omp_task_clauses): Likewise.
	(gimple_omp_task_clauses_ptr): Likewise.
	(gimple_omp_task_set_clauses): Likewise.
	(gimple_omp_task_child_fn): Likewise.
	(gimple_omp_task_child_fn_ptr): Likewise.
	(gimple_omp_task_set_child_fn): Likewise.
	(gimple_omp_task_data_arg): Likewise.
	(gimple_omp_task_data_arg_ptr): Likewise.
	(gimple_omp_task_set_data_arg): Likewise.
	(gimple_omp_taskreg_clauses): Likewise.
	(gimple_omp_taskreg_clauses_ptr): Likewise.
	(gimple_omp_taskreg_set_clauses): Likewise.
	(gimple_omp_taskreg_child_fn): Likewise.
	(gimple_omp_taskreg_child_fn_ptr): Likewise.
	(gimple_omp_taskreg_set_child_fn): Likewise.
	(gimple_omp_taskreg_data_arg): Likewise.
	(gimple_omp_taskreg_data_arg_ptr): Likewise.
	(gimple_omp_taskreg_set_data_arg): Likewise.
	(gimple_omp_task_copy_fn): Likewise.
	(gimple_omp_task_copy_fn_ptr): Likewise.
	(gimple_omp_task_set_copy_fn): Likewise.
	(gimple_omp_task_arg_size): Likewise.
	(gimple_omp_task_arg_size_ptr): Likewise.
	(gimple_omp_task_set_arg_size): Likewise.
	(gimple_omp_task_arg_align): Likewise.
	(gimple_omp_task_arg_align_ptr): Likewise.
	(gimple_omp_task_set_arg_align): Likewise.
	(gimple_omp_single_clauses): Likewise.
	(gimple_omp_single_clauses_ptr): Likewise.
	(gimple_omp_single_set_clauses): Likewise.
	(gimple_omp_target_clauses): Likewise.
	(gimple_omp_target_clauses_ptr): Likewise.
	(gimple_omp_target_set_clauses): Likewise.
	(gimple_omp_target_child_fn): Likewise.
	(gimple_omp_target_child_fn_ptr): Likewise.
	(gimple_omp_target_set_child_fn): Likewise.
	(gimple_omp_target_data_arg): Likewise.
	(gimple_omp_target_data_arg_ptr): Likewise.
	(gimple_omp_target_set_data_arg): Likewise.
	(gimple_omp_teams_clauses): Likewise.
	(gimple_omp_teams_clauses_ptr): Likewise.
	(gimple_omp_teams_set_clauses): Likewise.
	(gimple_omp_sections_clauses): Likewise.
	(gimple_omp_sections_clauses_ptr): Likewise.
	(gimple_omp_sections_set_clauses): Likewise.
	(gimple_omp_sections_control): Likewise.
	(gimple_omp_sections_control_ptr): Likewise.
	(gimple_omp_sections_set_control): Likewise.
	(gimple_omp_for_set_cond): Likewise.
	(gimple_omp_for_cond): Likewise.
	(gimple_omp_atomic_store_set_val): Likewise.
	(gimple_omp_atomic_store_val): Likewise.
	(gimple_omp_atomic_store_val_ptr): Likewise.
	(gimple_omp_atomic_load_set_lhs): Likewise.
	(gimple_omp_atomic_load_lhs): Likewise.
	(gimple_omp_atomic_load_lhs_ptr): Likewise.
	(gimple_omp_atomic_load_set_rhs): Likewise.
	(gimple_omp_atomic_load_rhs): Likewise.
	(gimple_omp_atomic_load_rhs_ptr): Likewise.
	(gimple_omp_continue_control_def): Likewise.
	(gimple_omp_continue_control_def_ptr): Likewise.
	(gimple_omp_continue_set_control_def): Likewise.
	(gimple_omp_continue_control_use): Likewise.
	(gimple_omp_continue_control_use_ptr): Likewise.
	(gimple_omp_continue_set_control_use): Likewise.
	(gimple_transaction_body_ptr): Likewise.
	(gimple_transaction_label): Likewise.
	(gimple_transaction_label_ptr): Likewise.
	(gimple_transaction_set_body): Likewise.
	(gimple_transaction_set_label): Likewise.

	* ipa-devirt.c (build_type_inheritance_graph): Likewise.
	* ipa-inline-analysis.c (inline_write_summary): Likewise.
	* ipa-ref.c (ipa_record_reference): Likewise.
	* ipa-reference.c (analyze_function): Likewise.
	(ipa_reference_write_optimization_summary): Likewise.
	* ipa.c (symtab_remove_unreachable_nodes): Likewise.
	(address_taken_from_non_vtable_p): Likewise.
	(comdat_can_be_unshared_p_1): Likewise.
	* lto-cgraph.c (lto_output_ref): Likewise.
	(add_references): Likewise.
	(compute_ltrans_boundary): Likewise.
	(output_symtab): Likewise.
	(input_ref): Likewise.
	(input_cgraph_1): Likewise.
	(output_cgraph_opt_summary): Likewise.
	* lto-streamer-out.c (lto_output): Likewise.
	(output_symbol_p): Likewise.
	* lto-streamer.h (lsei_next_function_in_partition): Likewise.
	(lsei_start_function_in_partition): Likewise.
	(lsei_next_variable_in_partition): Likewise.
	(lsei_start_variable_in_partition): Likewise.
	* symtab.c (insert_to_assembler_name_hash): Likewise.
	(unlink_from_assembler_name_hash): Likewise.
	(symtab_unregister_node): Likewise.
	(symtab_remove_node): Likewise.
	(dump_symtab_node): Likewise.
	(verify_symtab_base): Likewise.
	(verify_symtab_node): Likewise.
	(symtab_make_decl_local): Likewise.
	(symtab_alias_ultimate_target): Likewise.
	(symtab_resolve_alias): Likewise.
	(symtab_get_symbol_partitioning_class): Likewise.
	* tree-phinodes.c (allocate_phi_node): Likewise.
	(reserve_phi_args_for_new_edge): Likewise.
	(remove_phi_args): Likewise.
	* varpool.c (varpool_node_for_asm): Likewise.
	(varpool_remove_unreferenced_decls): Likewise.

gcc/lto/
	* lto-partition.c (add_references_to_partition): Update for
	removal of implicit pointer from the is-a.h API.
	(add_symbol_to_partition_1): Likewise.
	(contained_in_symbol): Likewise.
	(undo_partition): Likewise.
	(lto_balanced_map): Likewise.
	(promote_symbol): Likewise.
	* lto-symtab.c (lto_symtab_merge_symbols_1): Likewise.
	(lto_symtab_merge_symbols): Likewise.
	* lto.c (lto_wpa_write_files): Likewise.

From-SVN: r209719
2014-04-23 19:06:40 +00:00
Jakub Jelinek 368b454d67 tree-vrp.c (simplify_internal_call_using_ranges): If only one range is range_int_cst_p...
* tree-vrp.c (simplify_internal_call_using_ranges): If only
	one range is range_int_cst_p, but not both, at least optimize
	addition/subtraction of 0 and multiplication by 0 or 1.
	* gimple-fold.c (gimple_fold_call): Fold
	IFN_UBSAN_CHECK_{ADD,SUB,MUL}.
	(gimple_fold_stmt_to_constant_1): If both op0 and op1 aren't
	INTEGER_CSTs, try to fold at least x * 0 and y - y.

From-SVN: r208840
2014-03-26 10:17:10 +01:00
Martin Liska eb14a79f35 cgraph.c (cgraph_update_edges_for_call_stmt_node): Added case when gimple call statement is update.
* cgraph.c (cgraph_update_edges_for_call_stmt_node): Added case when
	gimple call statement is update.
	* gimple-fold.c (gimple_fold_call): Changed order for GIMPLE_ASSIGN and
	GIMPLE_CALL, where gsi iterator still points to GIMPLE CALL.

From-SVN: r208654
2014-03-18 17:10:39 +01:00
Jakub Jelinek ed9c79e1ea re PR ipa/58721 (The subroutine perdida is no longer inlined in fatigue.f90)
PR ipa/58721
gcc/
	* internal-fn.c: Include diagnostic-core.h.
	(expand_BUILTIN_EXPECT): New function.
	* gimplify.c (gimplify_call_expr): Use false instead of FALSE.
	(gimplify_modify_expr): Gimplify 3 argument __builtin_expect into
	IFN_BUILTIN_EXPECT call instead of __builtin_expect builtin call.
	* ipa-inline-analysis.c (find_foldable_builtin_expect): Handle
	IFN_BUILTIN_EXPECT.
	* predict.c (expr_expected_value_1): Handle IFN_BUILTIN_EXPECT.
	Revert 3 argument __builtin_expect code.
	(strip_predict_hints): Handle IFN_BUILTIN_EXPECT.
	* gimple-fold.c (gimple_fold_call): Likewise.
	* tree.h (fold_builtin_expect): New prototype.
	* builtins.c (build_builtin_expect_predicate): Add predictor
	argument, if non-NULL, create 3 argument __builtin_expect.
	(fold_builtin_expect): No longer static.  Add ARG2 argument,
	pass it through to build_builtin_expect_predicate.
	(fold_builtin_2): Adjust caller.
	(fold_builtin_3): Handle BUILT_IN_EXPECT.
	* internal-fn.def (BUILTIN_EXPECT): New.
gcc/fortran/
	* trans.c (gfc_unlikely, gfc_likely): Don't add __builtin_expect
	if !optimize.

2014-03-18  Tobias Burnus  <burnus@net-b.de>

	PR ipa/58721
gcc/
	* predict.def (PRED_FORTRAN_OVERFLOW, PRED_FORTRAN_FAIL_ALLOC,
	PRED_FORTRAN_FAIL_IO, PRED_FORTRAN_WARN_ONCE, PRED_FORTRAN_SIZE_ZERO,
	PRED_FORTRAN_INVALID_BOUND, PRED_FORTRAN_ABSENT_DUMMY): Add.
gcc/fortran/
	* trans.h (gfc_unlikely, gfc_likely): Add predictor as argument.
	(gfc_trans_io_runtime_check): Remove.
	* trans-io.c (gfc_trans_io_runtime_check): Make static; add has_iostat
	as argument, add predictor to block.
	(set_parameter_value, gfc_trans_open, gfc_trans_close, build_filepos,
	gfc_trans_inquire, gfc_trans_wait, build_dt): Update calls.
	* trans.c (gfc_unlikely, gfc_likely): Add predictor as argument.
	(gfc_trans_runtime_check, gfc_allocate_using_malloc,
	gfc_allocate_allocatable, gfc_deallocate_with_status): Set explicitly
	branch predictor.
	* trans-expr.c (gfc_conv_procedure_call): Ditto.
	* trans-stmt.c (gfc_trans_allocate): Ditto.
	* trans-array.c (gfc_array_init_size, gfc_array_allocate): Ditto.

2014-03-18  Jan Hubicka  <hubicka@ucw.cz>

	PR ipa/58721
gcc/
	* predict.c (combine_predictions_for_bb): Fix up formatting.
	(expr_expected_value_1, expr_expected_value): Add predictor argument,
	fill what it points to if non-NULL.
	(tree_predict_by_opcode): Adjust caller, use the predictor.
	* predict.def (PRED_COMPARE_AND_SWAP): Add.

From-SVN: r208641
2014-03-18 12:31:04 +01:00
Jan Hubicka ec77d61fe3 re PR lto/59468 (ICE on invalid C++ code with LTO in gimple_get_virt_method_for_binfo, at gimple-fold.c:3224)
PR lto/59468
	* ipa-utils.h (possible_polymorphic_call_targets): Update prototype
	and wrapper.
	* ipa-devirt.c: Include demangle.h
	(odr_violation_reported): New static variable.
	(add_type_duplicate): Update odr_violations.
	(maybe_record_node): Add completep parameter; update it.
	(record_target_from_binfo): Add COMPLETEP parameter;
	update it as needed.
	(possible_polymorphic_call_targets_1): Likewise.
	(struct polymorphic_call_target_d): Add nonconstruction_targets;
	rename FINAL to COMPLETE.
	(record_targets_from_bases): Sanity check we found the binfo;
	fix COMPLETEP updating.
	(possible_polymorphic_call_targets): Add NONCONSTRUTION_TARGETSP
	parameter, fix computing of COMPLETEP.
	(dump_possible_polymorphic_call_targets): Imrove readability of dump; at
	LTO time do demangling.
	(ipa_devirt): Use nonconstruction_targets; Improve dumps.
	* gimple-fold.c (gimple_get_virt_method_for_vtable): Add can_refer
	parameter.
	(gimple_get_virt_method_for_binfo): Likewise.
	* gimple-fold.h (gimple_get_virt_method_for_binfo,
	gimple_get_virt_method_for_vtable): Update prototypes.

	PR lto/59468
	* g++.dg/ipa/devirt-27.C: New testcase.
	* g++.dg/ipa/devirt-26.C: New testcase.

From-SVN: r207702
2014-02-11 22:54:21 +00:00
Jan Hubicka 8c311b50d1 gimple-fold.c (gimple_get_virt_method_for_vtable): Do O(1) lookup in the vtable constructor.
* gimple-fold.c (gimple_get_virt_method_for_vtable): Do O(1)
	lookup in the vtable constructor.

From-SVN: r207616
2014-02-07 23:26:39 +00:00
Jan Hubicka a33a931b5f * gimple-fold.c (can_refer_decl_in_current_unit_p): Default visibility is safe.
From-SVN: r207523
2014-02-05 20:42:37 +00:00
Jan Hubicka 6f746413d4 gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Remove.
* gimple-fold.c (gimple_extract_devirt_binfo_from_cst): Remove.
	* gimple-fold.h (gimple_extract_devirt_binfo_from_cst): Remove.

From-SVN: r207450
2014-02-04 06:04:32 +00:00
Jan Hubicka 9de2f554ec ipa-cp.c (ipa_get_indirect_edge_target_1): Do direct lookup via vtable pointer...
* 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.

	* g++.dg/ipa/devirt-25.C: New testcase.

From-SVN: r207447
2014-02-04 03:42:37 +00:00
Jan Hubicka 85942f45e9 re PR ipa/59831 (ice in cgraph_speculative_call_info with -O3)
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
2014-02-03 20:41:30 +00:00
Jakub Jelinek 9a7eefec74 re PR tree-optimization/59860 (ICE in compute_may_aliases, at tree-ssa-structalias.c:6843)
PR middle-end/59860
	* tree.h (fold_builtin_strcat): New prototype.
	* builtins.c (fold_builtin_strcat): No longer static.  Add len
	argument, if non-NULL, don't call c_strlen.  Optimize
	directly into __builtin_memcpy instead of __builtin_strcpy.
	(fold_builtin_2): Adjust fold_builtin_strcat caller.
	* gimple-fold.c (gimple_fold_builtin): Handle BUILT_IN_STRCAT.

From-SVN: r206848
2014-01-20 19:18:21 +01:00
Marek Polacek 30078c0a65 re PR c/58346 (ICE with SIGFPE at -O1 and above on x86_64-linux-gnu (affecting trunk, 4.8, 4.7, and 4.6))
PR c/58346
	* gimple-fold.c (fold_array_ctor_reference): Don't fold if element
	size is zero.
testsuite/
	* gcc.dg/pr58346.c: New test.

From-SVN: r206715
2014-01-17 14:51:56 +00:00
Jakub Jelinek 19e51b409e re PR tree-optimization/59387 (wrong code (hangs) at -Os on x86_64-linux-gnu)
PR tree-optimization/59387
	* tree-scalar-evolution.c: Include gimple-fold.h and gimplify-me.h.
	(scev_const_prop): If folded_casts and type has undefined overflow,
	use force_gimple_operand instead of force_gimple_operand_gsi and
	for each added stmt if it is assign with
	arith_code_with_undefined_signed_overflow, call
	rewrite_to_defined_overflow.
	* tree-ssa-loop-im.c: Don't include gimplify-me.h, include
	gimple-fold.h instead.
	(arith_code_with_undefined_signed_overflow,
	rewrite_to_defined_overflow): Moved to ...
	* gimple-fold.c (arith_code_with_undefined_signed_overflow,
	rewrite_to_defined_overflow): ... here.  No longer static.
	Include gimplify-me.h.
	* gimple-fold.h (arith_code_with_undefined_signed_overflow,
	rewrite_to_defined_overflow): New prototypes.

	* gcc.c-torture/execute/pr59387.c: New test.

From-SVN: r206583
2014-01-13 20:14:03 +01:00
Jakub Jelinek a70e9985fd re PR tree-optimization/59622 (internal compiler error: verify_gimple failed)
PR tree-optimization/59622
	* gimple-fold.c (gimple_fold_call): Fix a typo in message.  For
	__builtin_unreachable replace the OBJ_TYPE_REF call with a call to
	__builtin_unreachable and add if needed a setter of the lhs SSA_NAME.
	Don't devirtualize for inplace at all.  For targets.length () == 1,
	if the call is noreturn and cfun isn't in SSA form yet, clear lhs.

	* g++.dg/opt/pr59622-2.C: New test.
	* g++.dg/opt/pr59622-3.C: New test.
	* g++.dg/opt/pr59622-4.C: New test.
	* g++.dg/opt/pr59622-5.C: New test.

From-SVN: r206492
2014-01-09 21:09:33 +01:00
Richard Biener 5c944c6cb8 re PR middle-end/59630 (ICE converting the return type of a builtin function)
2014-01-08  Richard Biener  <rguenther@suse.de>

	PR middle-end/59630
	* gimple.h (is_gimple_builtin_call): Remove.
	(gimple_builtin_call_types_compatible_p): New.
	(gimple_call_builtin_p): New overload.
	* gimple.c (is_gimple_builtin_call): Remove.
	(validate_call): Rename to ...
	(gimple_builtin_call_types_compatible_p): ... this and export.  Also
	check return types.
	(validate_type): New static function.
	(gimple_call_builtin_p): New overload and adjust.
	* gimple-fold.c (gimple_fold_builtin): Fold the return value.
	(gimple_fold_call): Likewise.  Use gimple_call_builtin_p.
	(gimple_fold_stmt_to_constant_1): Likewise.
	* tsan.c (instrument_gimple): Use gimple_call_builtin_p.

	* gcc.dg/pr59630.c: New testcase.

From-SVN: r206421
2014-01-08 09:06:27 +00:00
Richard Sandiford 23a5b65a92 Update copyright years in gcc/
From-SVN: r206289
2014-01-02 22:23:26 +00:00
Jakub Jelinek cf3e5a89ae re PR tree-optimization/59622 (internal compiler error: verify_gimple failed)
PR tree-optimization/59622
	* gimple-fold.c (gimple_fold_call): Don't replace OBJ_TYPE_REF
	call fndecl with 0 possible targets with BUILT_IN_UNREACHABLE,
	instead only for !inplace add a __builtin_unreachable () call
	before the call.

	* g++.dg/opt/pr59622.C: New test.

From-SVN: r206264
2013-12-31 12:57:39 +01:00
Jan Hubicka bdf37f7a71 re PR middle-end/35545 (tracer pass is run too late)
PR middle-end/35535
	* gimple-fold.c (fold_gimple_assign): Attempt to devirtualize
	OBJ_TYPE_REF.
	(gimple_fold_stmt_to_constant_1): Bypass OBJ_TYPE_REF wrappers.

From-SVN: r206074
2013-12-17 23:43:22 +00:00
Jan Hubicka 61dd6a2e33 devirt-13.C: Update template.
* g++.dg/ipa/devirt-13.C: Update template.
	* ipa-utils.h (possible_polymorphic_call_targets): Determine context of
	the call.
	* gimple-fold.c (gimple_fold_call): Use ipa-devirt to devirtualize.

From-SVN: r206042
2013-12-17 10:26:59 +00:00
Oleg Endo 2c8326a568 asan.c: Remove struct tags when referring to class varpool_node.
* asan.c: Remove struct tags when referring to class varpool_node.
	* cgraph.h: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphunit.c: Likewise.
	* dbxout.c: Likewise.
	* dwarf2out.c: Likewise.
	* gimple-fold.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-ref-inline.h: Likewise.
	* ipa-ref.h: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-utils.c: Likewise.
	* ipa.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.h: Likewise.
	* passes.c: Likewise.
	* toplev.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-emutls.c: Likewise.
	* tree-pass.h: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.

	* cp/decl2.c: Remove struct tags when referring to class varpool_node.

	* lto/lto.c: Remove struct tags when referring to class varpool_node.
	* lto/lto-partition.c: Likewise.
	* lto/lto-symtab.c: Likewise.

From-SVN: r205733
2013-12-06 10:40:53 +00:00
Marek Polacek 31e071aeb8 Implement -fsanitize=signed-integer-overflow.
From-SVN: r205684
2013-12-04 22:47:11 +00:00
Tom de Vries e934916c86 Don't create out-of-bounds BIT_FIELD_REF.
2013-11-27  Tom de Vries  <tom@codesourcery.com>
	    Marc Glisse  <marc.glisse@inria.fr>

	PR middle-end/59037
	* semantics.c (cxx_fold_indirect_ref): Don't create out-of-bounds
	BIT_FIELD_REF.

	* fold-const.c (fold_indirect_ref_1): Don't create out-of-bounds
	BIT_FIELD_REF.
	* gimple-fold.c (gimple_fold_indirect_ref): Same.
	* tree-cfg.c (verify_expr): Give error if BIT_FIELD_REF is
	out-of-bounds.

	* c-c++-common/pr59037.c: New testcase.

Co-Authored-By: Marc Glisse <marc.glisse@inria.fr>

From-SVN: r205438
2013-11-27 10:00:30 +00:00
Andrew MacLeod 2fb9a547b4 gimple.h: Remove all includes.
* gimple.h: Remove all includes.
	(recalculate_side_effects): Move prototype to gimplify.h.
	* Makefile.in (PLUGIN_HEADERS): Add flattened gimple.h includes.
	* gengtype.c (open_base_files): Add gimple.h include list.
	* gimplify.h (recalculate_side_effects): Relocate prototype here.
	* gimple.c: Adjust include list.
	(recalculate_side_effects): Move to gimplify.c.
	* gimplify.c: Adjust include list.
	(recalculate_side_effects): Relocate from gimple.c.
	* alias.c: Add required include files removed from gimple.h.
	* asan.c: Likewise.
	* builtins.c: Likewise.
	* calls.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* cilk-common.c: Likewise.
	* data-streamer.c: Likewise.
	* data-streamer-in.c: Likewise.
	* data-streamer-out.c: Likewise.
	* dse.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* gimple-builder.c: Likewise.
	* gimple-expr.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple-ssa-isolate-paths.c: Likewise.
	* gimple-ssa-strength-reduction.c: Likewise.
	* gimple-streamer-in.c: Likewise.
	* gimple-streamer-out.c: Likewise.
	* gimple-walk.c: Likewise.
	* gimplify-me.c: Likewise.
	* graphite-blocking.c: Likewise.
	* graphite.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.
	* internal-fn.c: Likewise.
	* ipa.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-inline-analysis.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-profile.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-utils.c: Likewise.
	* langhooks.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-compress.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* omp-low.c: Likewise.
	* opts-global.c: Likewise.
	* passes.c: Likewise.
	* predict.c: Likewise.
	* profile.c: Likewise.
	* sese.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* symtab.c: Likewise.
	* targhooks.c: Likewise.
	* toplev.c: Likewise.
	* tracer.c: Likewise.
	* trans-mem.c: Likewise.
	* tree-affine.c: Likewise.
	* tree.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-emutls.c: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-ssa-operands.c: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* tree-ssa-strlen.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-tail-merge.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa-uninit.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-streamer.c: Likewise.
	* tree-streamer-in.c: Likewise.
	* tree-streamer-out.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vrp.c: Likewise.
	* tsan.c: Likewise.
	* ubsan.c: Likewise.
	* value-prof.c: Likewise.
	* varpool.c: Likewise.
	* var-tracking.c: Likewise.
	* vtable-verify.c: Likewise.

	* ada/gcc-interface/trans.c: Add required include files from gimple.h.

	* c/c-typeck.c: Add required include files from gimple.h.

	* c-family/c-common.c: Add required include files from gimple.h.
	* c-family/c-gimplify.c: Likewise
	* c-family/cilk.c: Likewise

	* cp/class.c: Add required include files from gimple.h.
	* cp/cp-gimplify.c: Likewise
	* cp/decl2.c: Likewise
	* cp/init.c: Likewise
	* cp/optimize.c: Likewise
	* cp/pt.c: Likewise
	* cp/semantics.c: Likewise
	* cp/tree.c: Likewise
	* cp/typeck.c: Likewise
	* cp/vtable-class-hierarchy.c: Likewise

	* fortran/trans.c: Add required include files from gimple.h.
	* fortran/trans-expr.c: Likewise
	* fortran/trans-openmp.c: Likewise

	* go/gofrontend/expressions.cc: Add required include files from
	gimple.h.
	* go/gofrontend/gogo-tree.cc: Likewise
	* go/gofrontend/types.cc: Likewise
	* go/go-gcc.cc: Likewise
	* go/go-lang.c: Likewise

	* java/java-gimplify.c: Add required include files from gimple.h.

	* lto/lto.c: Add required include files from gimple.h.
	* lto/lto-lang.c: Likewise
	* lto/lto-object.c: Likewise
	* lto/lto-partition.c: Likewise
	* lto/lto-symtab.c: Likewise

	* objc/objc-act.c: Add required include files from gimple.h.

	* config/darwin.c: Add required include files removed from gimple.h.
	* config/aarch64/aarch64-builtins.c: Likewise.
	* config/aarch64/aarch64.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/winnt.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/m32c/m32c.c: Likewise.
	* config/mep/mep.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/tilegx/tilegx.c: Likewise.
	* config/tilepro/tilepro.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.

	* testsuite/gcc.dg/plugin/finish_unit_plugin.c: Add required include
	files removed from gimple.h.
	* testsuite/gcc.dg/plugin/ggcplug.c: Likewise.
	* testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise.
	* testsuite/gcc.dg/plugin/selfassign.c: Likewise.
	* testsuite/gcc.dg/plugin/start_unit_plugin.c: Likewise.
	* testsuite/g++.dg/plugin/selfassign.c: Likewise.

From-SVN: r205272
2013-11-22 15:58:51 +00:00