Commit Graph

459 Commits

Author SHA1 Message Date
Richard Biener 6184085fc6 Update ChangeLog and version files for release
From-SVN: r257041
2018-01-25 08:17:27 +00:00
Richard Biener 586a0829dc Update ChangeLog and version files for release
From-SVN: r251081
2017-08-14 07:59:11 +00:00
GCC Administrator 303f81ad7e Update ChangeLog and version files for release
From-SVN: r247493
2017-05-02 12:42:24 +00:00
Richard Biener 350792ffae re PR target/79671 (mapnik miscompilation on armv7hl since r235622)
2017-04-12  Richard Biener  <rguenther@suse.de>
	Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR middle-end/79671
	* alias.c (component_uses_parent_alias_set_from): Handle
	TYPE_TYPELESS_STORAGE.
	(get_alias_set): Likewise.
	* tree-core.h (tree_type_common): Add typeless_storage flag.
	* tree.h (TYPE_TYPELESS_STORAGE): New macro.
	* stor-layout.c (place_union_field): Set TYPE_TYPELESS_STORAGE
	for types containing members with TYPE_TYPELESS_STORAGE.
	(place_field): Likewise.
	(layout_type): Likewise for ARRAY_TYPE.
	* lto-streamer-out.c (hash_tree): Hash TYPE_TYPELESS_STORAGE.
	* tree-streamer-in.c (unpack_ts_type_common_value_fields): Stream
	TYPE_TYPELESS_STORAGE.
	* tree-streamer-out.c (pack_ts_type_common_value_fields): Likewise.

	lto/
	* lto.c (compare_tree_sccs_1): Compare TYPE_TYPELESS_STORAGE.

	cp/
	* tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
	for arrays of character or std::byte type.

	* g++.dg/torture/pr79671.C: New testcase.
	* g++.dg/lto/pr79671_0.C: Likewise.
	* g++.dg/lto/pr79671_1.c: Likewise.

Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>

From-SVN: r246866
2017-04-12 07:35:49 +00:00
Martin Liska 4a44a5f3eb Fix memory leak in LTO
2017-02-14  Martin Liska  <mliska@suse.cz>

	* lto.c (do_stream_out): Free LTO file filename string.

From-SVN: r245431
2017-02-14 14:56:11 +00:00
Maxim Ostapenko e3d53f96ed re PR lto/79061 ([LTO][ASAN] LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco")
Revert fix for PR lto/79061 due to this regresses compile-time by 100%
on some fortran cases.

From-SVN: r244773
2017-01-23 11:12:29 +02:00
David Malcolm 8a3a6ab451 Make LTO's implementation of LANG_HOOKS_TYPE_FOR_SIZE the default
gcc/jit/ChangeLog:
	* dummy-frontend.c (jit_langhook_type_for_size): Delete.
	(LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine.

gcc/ChangeLog:
	* langhooks-def.h (lhd_type_for_size): New decl.
	(LANG_HOOKS_TYPE_FOR_SIZE): Define as lhd_type_for_size.
	* langhooks.c (lhd_type_for_size): New function, taken from
	lto_type_for_size.

gcc/lto/ChangeLog:
	* lto-lang.c (builtin_type_for_size): Convert call to
	lto_type_for_size to one through the langhook.
	(lto_type_for_size): Move to langhooks.c and rename to
	lhd_type_for_size.
	(LANG_HOOKS_TYPE_FOR_SIZE): Don't redefine.

From-SVN: r244646
2017-01-19 17:27:54 +00:00
Maxim Ostapenko 5807fb918d re PR lto/79061 ([LTO][ASAN] LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco")
PR lto/79061
gcc/

	* asan.c (get_translation_unit_decl): New function.
	(asan_add_global): Extract modules file name from globals
	TRANSLATION_UNIT_DECL in lto mode.
	* tree.c (build_translation_unit_decl): Add source location for newly
	built TRANSLATION_UNIT_DECL.

gcc/lto/

	* lto.c (lto_read_decls): accept location cache for
	TRANSLATION_UNIT_DECL.
	
gcc/testsuite/

	* gcc.dg/cpp/mi1.c: Adjust testcase.
	* gcc.dg/pch/cpp-3.c: Likewise.

From-SVN: r244581
2017-01-18 18:06:31 +02:00
Jakub Jelinek 4c4b47031d re PR middle-end/50199 (wrong code with -flto -fno-merge-constants)
PR middle-end/50199
	* lto-lang.c (lto_post_options): Force flag_merge_constants = 1
	if it was 0.

	* gcc.dg/lto/pr50199_0.c: New test.

From-SVN: r244304
2017-01-11 09:40:59 +01:00
Jakub Jelinek bd2c62704b re PR translation/79019 (translatable string typo in cif-code.def:141)
PR translation/79019
	PR translation/79020
	* params.def (PARAM_INLINE_MIN_SPEEDUP,
	PARAM_IPA_CP_SINGLE_CALL_PENALTY,
	PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos
	in descriptions.
	* config/avr/avr.opt (maccumulate-args): Likewise.
	* config/msp430/msp430.opt (mwarn-mcu): Likewise.
	* common.opt (freport-bug): Likewise.
	* cif-code.def (CIF_FINAL_ERROR): Likewise.
	* doc/invoke.texi (ipa-cp-single-call-penalty): Likewise.
	* config/s390/s390.c (s390_invalid_binary_op): Fix spelling in
	translatable string.
	* config/i386/i386.c (function_value_32): Likewise.
	* config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise.
	* config/msp430/msp430.c (msp430_option_override, msp430_attr):
	Likewise.
	* config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise.
	* common/config/msp430/msp430-common.c (msp430_handle_option):
	Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* opts.c (set_debug_level): Likewise.
	* tree.c (verify_type_variant): Likewise.  Fix typo in comment.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
	missing whitespace to translatable strings.
	* config/avr/avr.md (bswapsi2): Fix typo in comment.
	* config/sh/superh.h: Likewise.
	* config/i386/xopintrin.h: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise.
	* ipa-inline-analysis.c (compute_inline_parameters): Likewise.
	* double-int.h (struct double_int): Likewise.
	* double-int.c (div_and_round_double): Likewise.
	* wide-int.cc: Likewise.
	* tree-ssa.c (non_rewritable_mem_ref_base): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	* cfgcleanup.c (crossjumps_occured): Renamed to ...
	(crossjumps_occurred): ... this.
	(try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg):
	Adjust all uses.
cp/
	* semantics.c (finish_omp_clauses): Add missing whitespace to
	translatable strings.
	* cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
lto/
	* lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo.
fortran/
	* decl.c (attr_decl1): Fix spelling in translatable string.
	* intrinsic.texi: Fix spelling - invokation -> invocation.
	* lang.opt (faggressive-function-elimination, gfc_convert): Fix
	typos in descriptions.
	* openmp.c (resolve_omp_clauses): Add missing whitespace to
	translatable strings.
c-family/
	* c.opt (Wnormalized=): Fix typo in description.
testsuite/
	* c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of
	diagnostics.
	* gfortran.dg/initialization_17.f90: Likewise.

From-SVN: r244245
2017-01-09 22:48:33 +01:00
Nathan Sidwell 5406184ce7 lto-partition.c (promote_symbol): Write to dump file sooner, include alias promoting too.
* lto-partition.c (promote_symbol): Write to dump file sooner,
	include alias promoting too.

From-SVN: r244159
2017-01-06 14:08:02 +00:00
Nathan Sidwell 24d3f3251c ipa-visibility.c (function_and_variable_visibility): Reformat comments and long lines.
gcc/
	* ipa-visibility.c (function_and_variable_visibility): Reformat
	comments and long lines.  Remove extrneous if.
	* symtab.c (symtab_node::make_decl_local): Fix code format.
	(symtab_node::set_section_for_node): Fix comment typo.

	gcc/lto/
	* lto-partition.c (lto_balanced_map): Reformat/respell comment.
	(may_need_named_section_p): Likewise.
	(rename_statics): Likewise.
	(lto_promote_cross_file_statics): Likewise.

From-SVN: r244156
2017-01-06 14:04:05 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Georg-Johann Lay 6c8bf06658 re PR lto/78562 (Wrong warning for built-in functions with -flto)
gcc/lto/
	PR lto/78562
	* lto-symtab.c (lto_symtab_merge_decls_2): Don't diagnose type
	mismatch if the two types are built-in.

From-SVN: r243008
2016-11-30 11:08:37 +00:00
Prathamesh Kulkarni 7fa6a96535 tree.c (build_common_tree_nodes): Initialize ptrdiff_type_node.
2016-11-26  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* tree.c (build_common_tree_nodes): Initialize ptrdiff_type_node.
	(free_lang_data): Remove assignment to ptrdiff_type_node.
c-family/
	* c-common.c (c_common_nodes_and_builtins): Remove initialization of
	ptrdiff_type_node.
lto/
	* lto-lang.c (lto_init): Remove initialization of ptrdiff_type_node.

From-SVN: r242888
2016-11-26 10:41:55 +00:00
Richard Biener efb7123241 re PR lto/78472 (warning: type of 's' does not match original declaration from zero length bitfield in C vs C++)
2016-11-23  Richard Biener  <rguenther@suse.de>

	PR lto/78472
	* tree.c (gimple_canonical_types_compatible_p): Ignore zero-sized
	fields.

	lto/
	* lto.c (hash_canonical_type): Ignore zero-sized fields.

	* g++.dg/lto/pr78472_0.c: New testcase.
	* g++.dg/lto/pr78472_1.C: Likewise.

From-SVN: r242746
2016-11-23 11:24:55 +00:00
Bernd Edlinger 48330c9355 re PR c++/71973 (c++ handles built-in functions inconsistently)
gcc:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* doc/invoke.texi (-Wno-builtin-declaration-mismatch): Document the
	new default-enabled warning..
	* builtin-types.def (BT_CONST_TM_PTR): New primitive type.
	(BT_PTR_CONST_STRING): Updated.
	(BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR): Removed.
	(BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_TM_PTR): New function type.
	* builtins.def (DEF_TM_BUILTIN): Disable BOTH_P for TM builtins.
	(strftime): Update builtin function.
	* tree-core.h (TI_CONST_TM_PTR_TYPE): New enum value.
	* tree.h (const_tm_ptr_type_node): New type node.
	* tree.c (free_lang_data, build_common_tree_nodes): Initialize
	const_tm_ptr_type_node.

c-family:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* c.opt (-Wbuiltin-declaration-mismatch): New warning.
	* c-common.c (c_common_nodes_and_builtins): Initialize
	const_tm_ptr_type_node.

c:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* c-decl.c (diagnose_mismatched_decls): Use
	OPT_Wbuiltin_declaration_mismatch here too.

cp:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* decl.c (duplicate_decls): Warn when a built-in function is redefined.
	Don't overload builtin functions with C++ functions.
	Handle const_tm_ptr_type_node like file_ptr_node.
	Copy the TREE_NOTHROW flag unmodified to the old decl.

lto:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* lto-lang.c (lto_init): Assert const_tm_ptr_type_node is sane.

testsuite:
2016-11-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/71973
	* g++.dg/pr71973-1.C: New test.
	* g++.dg/pr71973-2.C: New test.
	* g++.dg/pr71973-3.C: New test.
	* g++.dg/lto/pr68811_0.C: Add -w to first lto-options.
	* g++.dg/lookup/extern-c-redecl4.C: Adjust test expectations.
	* g++.old-deja/g++.mike/p700.C: Add -Wno-builtin-declaration-mismatch
	to dg-options.
	* g++.old-deja/g++.other/realloc.C: Likewise.
	* g++.old-deja/g++.other/builtins10.C: Adjust test expectations.

From-SVN: r242662
2016-11-21 14:17:05 +00:00
Richard Sandiford 899ca90e6d Add SET_DECL_MODE
This may no longer be necessary with the current version
of the SVE patches, but it does at least make things consistent
with the TYPE_MODE/SET_TYPE_MODE split.

gcc/ada/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* gcc-interface/utils.c (create_label_decl): Use SET_DECL_MODE.

gcc/c/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* c-decl.c (merge_decls): Use SET_DECL_MODE.
	(make_label, finish_struct): Likewise.

gcc/cp/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* class.c (finish_struct_bits): Use SET_DECL_MODE.
	(build_base_field_1, layout_class_type, finish_struct_1): Likewise.
	* decl.c (make_label_decl): Likewise.
	* pt.c (tsubst_decl): Likewise.

gcc/fortran/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* trans-common.c (build_common_decl): Use SET_DECL_MODE.
	* trans-decl.c (gfc_build_label_decl): Likewise.
	* trans-types.c (gfc_get_array_descr_info): Likewise.

gcc/lto/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* lto.c (offload_handle_link_vars): Use SET_DECL_MODE.

gcc/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* tree.h (SET_DECL_MODE): New macro.
	* cfgexpand.c (avoid_deep_ter_for_debug): Use SET_DECL_MODE.
	(expand_gimple_basic_block): Likewise.
	* function.c (split_complex_args): Likeise.
	* ipa-prop.c (ipa_modify_call_arguments): Likewise.
	* omp-simd-clone.c (ipa_simd_modify_stmt_ops): Likewise.
	* stor-layout.c (layout_decl, relayout_decl): Likewise.
	(finish_bitfield_representative): Likewise.
	* tree.c (make_node_stat): Likewise.
	* tree-inline.c (remap_ssa_name): Likewise.
	(tree_function_versioning): Likewise.
	* tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise.
	* tree-sra.c (sra_ipa_reset_debug_stmts): Likewise.
	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Likewise.
	* tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise.
	* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
	* tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise.
	* varasm.c (make_debug_expr_from_rtl): Likewise.

libcc1/
2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 	    Alan Hayward  <alan.hayward@arm.com>
 	    David Sherwood  <david.sherwood@arm.com>

	* plugin.cc (plugin_build_add_field): Use SET_DECL_MODE.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r242585
2016-11-18 10:03:12 +00:00
Richard Biener 6517958578 re PR lto/78129 (-Werror=suggest-final-types leads to -ENOSPC.)
2016-10-31  Richard Biener  <rguenther@suse.de>

	PR lto/78129
	* lto.c (do_whole_program_analysis): Bail out after errors
	from WPA analysis.

From-SVN: r241698
2016-10-31 12:52:23 +00:00
Kugan Vivekanandarajah 8bc5448f39 Add IPA VRP
gcc/lto/ChangeLog:
2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* lto-partition.c: Include tree-vrp.h.
	* lto.c: Likewise.

gcc/testsuite/ChangeLog:

2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* g++.dg/ipa/pure-const-3.C: Add -fno-ipa-vrp. Else constant arguments
	will be optimized away.
	* gcc.dg/ipa/vrp1.c: New test.
	* gcc.dg/ipa/vrp2.c: New test.
	* gcc.dg/ipa/vrp3.c: New test.

gcc/ChangeLog:

2016-09-21  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* common.opt: New option -fipa-vrp.
	* ipa-cp.c (ipa_get_vr_lat): New.
	(ipcp_vr_lattice::print): Likewise.
	(print_all_lattices): Call ipcp_vr_lattice::print.
	(ipcp_vr_lattice::meet_with): New.
	(ipcp_vr_lattice::meet_with_1): Likewise.
	(ipcp_vr_lattice::top_p): Likewise.
	(ipcp_vr_lattice::bottom_p): Likewsie.
	(ipcp_vr_lattice::set_to_bottom): Likewise.
	(set_all_contains_variable): Call VR set_to_bottom.
	(initialize_node_lattices): Init VR lattices.
	(propagate_vr_accross_jump_function): New.
	(propagate_constants_accross_call): Call
	propagate_vr_accross_jump_function.
	(ipcp_store_vr_results): New.
	(ipcp_driver): Handle VR.
	* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Handle VR.
	(ipa_set_jf_unknown): Likewise.
	(ipa_compute_jump_functions_for_edge): Likewise.
	(ipa_node_params_t::duplicate): Likewise.
	(ipa_write_jump_function): Likewise.
	(ipa_read_jump_function): Likewise.
	(write_ipcp_transformation_info): Likewise.
	(read_ipcp_transformation_info): Likewise.
	(ipcp_update_vr): New.
	(ipcp_transform_function): Handle VR.
	* ipa-prop.h (struct ipa_vr): New.
	* cgraph.c: Include tree-vrp.h.
	* cgraphunit.c: Likewise.
	* ipa-utils.c: Likewise.
	* ipa.c: Likewise.

From-SVN: r240292
2016-09-20 23:29:05 +00:00
Richard Biener 6831798543 debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook.
2016-09-20  Richard Biener  <rguenther@suse.de>

	* debug.h (gcc_debug_hooks): Add filename parameter to early_finish
	hook.
	* debug.c (do_nothing_debug_hooks): Adjust.
	* dbxout.c (dbx_debug_hooks): Likewise.
	* sdbout.c (sdb_debug_hooks): Likewise.
	* dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise.
	(dwarf2out_finish): Move producer, filename and
	path annotation ...
	(dwarf2out_early_finish): ... here.  Remove in_lto_p special-casing.
	* cgraphunit.c (symbol_table::finalize_compilation_unit): Adjust.

	lto/
	* lto.c (lto_main): Call early_finish with "<artificial>" as
	filename.

From-SVN: r240255
2016-09-20 07:37:53 +00:00
Richard Biener 321e76fbf8 dwarf2out.c (early_dwarf_finished): New global.
2016-09-16  Richard Biener  <rguenther@suse.de>

	* dwarf2out.c (early_dwarf_finished): New global.
	(set_early_dwarf::set_early_dwarf): Assert early_dwarf_finished
	is false.
	(dwarf2out_early_finish): Set early_dwarf_finished at the end,
	if called from LTO exit early.
	(dwarf2out_late_global_decl): When being during the early
	debug phase do not add locations but only const value attributes.
	Adjust the way we generate early DIEs for LTO.

	lto/
	* lto.c (lto_main): Invoke early_finish debug hook.

From-SVN: r240228
2016-09-19 07:20:16 +00:00
Jakub Jelinek 3f8257db2e ChangeLog formatting fixes.
From-SVN: r239997
2016-09-05 21:42:42 +02:00
Richard Biener ea6e17d5c0 cgraph.c (cgraph_node::verify_node): Compare against builtin by using DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE.
2016-07-25  Richard Biener  <rguenther@suse.de>

	* cgraph.c (cgraph_node::verify_node): Compare against builtin
	by using DECL_BUILT_IN_CLASS and DECL_FUNCTION_CODE.
	* tree-chkp.c (chkp_gimple_call_builtin_p): Likewise.
	* tree-streamer.h (streamer_handle_as_builtin_p): Remove.
	(streamer_get_builtin_tree): Likewise.
	(streamer_write_builtin): Likewise.
	* lto-streamer.h (LTO_builtin_decl): Remove.
	* lto-streamer-in.c (lto_read_tree_1): Remove assert.
	(lto_input_scc): Remove LTO_builtin_decl handling.
	(lto_input_tree_1): Liekwise.
	* lto-streamer-out.c (lto_output_tree_1): Remove special
	handling of builtins.
	(DFS::DFS): Likewise.
	* tree-streamer-in.c (streamer_get_builtin_tree): Remove.
	* tree-streamer-out.c (pack_ts_function_decl_value_fields): Remove
	assert.
	(streamer_write_builtin): Remove.

	lto/
	* lto.c (compare_tree_sccs_1): Remove streamer_handle_as_builtin_p uses.
	(unify_scc): Likewise.
	(lto_read_decls): Likewise.

From-SVN: r238709
2016-07-25 12:35:08 +00:00
Jakub Jelinek e9ac1f86bf Makefile.in: Don't cat ../stage_current if it does not exist.
* Makefile.in: Don't cat ../stage_current if it does not exist.
c/
	* Make-lang.in: Don't cat ../stage_current if it does not exist.
cp/
	* Make-lang.in: Don't cat ../stage_current if it does not exist.
lto/
	* Make-lang.in: Don't cat ../stage_current if it does not exist.

From-SVN: r237817
2016-06-28 10:38:38 +02:00
Andi Kleen 277d7ee0c9 Add make autoprofiledbootstrap
Add support for profiledbootstrap with autofdo. Will be useful
to get better testing coverage of autofdo.

This requires Linux perf and autofdo to be installed, only
really for x86_64 linux on Intel so far.

Profile the whole build process with perf, then convert the file,
and pass it back to the compiler in the feedback stage.

The conversion has to be done per language, as only that knows
the name of the binary. Currently we only do it for C and C++,
as the other languages don't have enough coverage during a normal
bootstrap.

For lto1 it is also disabled, because it would only be useful during a LTO
bootstrap, but right now autofdo and LTO are not working together due to
PR66229

For common backend files always the profile output of the C++ compiler
is used. In theory multiple inputs could be merged here, but so far
that is not implemented.

The method is not friendly to partial rebuilds, as only the profile
information from the current rebuild is used. So if an error
occurs it is best to clean and restart, otherwise the code
quality may be worse.

This patch is fairly large, but most of it is auto generated from
autogen in Makefile.in. for the new stage targets.

Passes profiledbootstrap and normal bootstrap on x86_64-linux.
autoprofiledbootstrap is currently not working due to
PR70427 (but it finishes with that worked around)

The autofdo'ed compiler is ~7% faster on insn-recog.i (vs ~11% for
profiledfeedback), and ~4% faster for tramp3d-v4 (vs 10% for
profiledfeedback) on a Sandy Bridge system.

gcc/lto/:

2016-06-23  Andi Kleen  <ak@linux.intel.com>

	* Make-lang.in: Add support for autofdo (disabled for now)

gcc/cp/:

2016-06-23  Andi Kleen  <ak@linux.intel.com>

	* Make-lang.in: Add support for autofdo.

gcc/:

2016-06-23  Andi Kleen  <ak@linux.intel.com>

	* Makefile.in: Regenerate.
	* doc/install.texi: Document autoprofiledbootstrap.

/:
2016-06-23  Andi Kleen  <ak@linux.intel.com>

	* Makefile.def: Add autoprofiledbootstrap.
	* Makefile.tpl: Dito.
	* Makefile.in: Regenerate.

gcc/c/:

2016-06-23  Andi Kleen  <ak@linux.intel.com>

	* Make-lang.in: Add support for autofdo.

From-SVN: r237733
2016-06-23 14:34:16 +00:00
Martin Sebor 4d926e3493 PR c/71392 - SEGV calling integer overflow built-ins with a null pointer
gcc/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro.
	(ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same.
	* builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use
	them.
	(BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same.
	(BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same.
	(BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same.
	(BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same.
	(BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same.
	(BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same.
	(BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same.
	(BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW):

gcc/ada/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept
	the nonnull attribute in type-generic builtins.

gcc/c-family/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/c-family/c-common.c (handle_nonnull_attribute): Accept
	the nonnull attribute in type-generic builtins.

gcc/lto/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull
	attribute in type-generic builtins.

gcc/testsuite/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* c-c++-common/builtin-arith-overflow-1.c: Add test cases.

From-SVN: r237314
2016-06-10 11:38:19 -06:00
Jan Hubicka 479f99c967 lto-cgraph.c (compute_ltrans_boundary, [...]): Fix handling of inline thunks
* lto-cgraph.c (compute_ltrans_boundary, output_symtab): Fix handling
	of inline thunks
	* lto-partition.c (add_symbol_to_partition_1): Likewise.

From-SVN: r236270
2016-05-16 09:55:14 +00:00
Jan Hubicka 1a0bf5e11b cgraph.c (symbol_table::create_edge): Set inline_failed.
* cgraph.c (symbol_table::create_edge): Set inline_failed.
	(cgraph_edge::make_direct): Likewise.
	(cgraph_edge::dump_edge_flags): Dump call_stmt_cannot_inline_p.
	* cgraphclones.c (duplicate_thunk_for_node): Set inline_failed.
	* cif-code.def (CIF_LTO_MISMATCHED_DECLARATIONS): New code
	(CIF_THUNK): New code.
	* ipa-inline-analysis.c (initialize_inline_failed): Preserve
	CIF_FINAL_ERROR codes; do not deal with call_stmt_cannot_inline_p.
	(compute_inline_parameters): Set inline_failed for thunks.
	(inline_analyze_function): Cleanup.
	* ipa-inline.c (can_inline_edge_p): Do not deal with
	call_stmt_cannot_inline_p.
	(can_early_inline_edge_p): Likewise.
	(early_inliner): Initialize inline_failed.
	* lto-cgraph.c (lto_output_edge): Sanity check inline_failed.

	* lto-symtab.c (lto_cgraph_replace_node): Initialize inline_failed.

From-SVN: r235839
2016-05-03 19:05:31 +00:00
Prathamesh Kulkarni a2e76867ad params.def (MAX_PARTITION_SIZE): New param.
2016-04-27  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* params.def (MAX_PARTITION_SIZE): New param.
	* invoke.texi: Document lto-max-partition.
lto/
	* lto-partition.h (lto_balanced_map): New parameter.
	* lto-partition.c (lto_balanced_map): New parameter
	max_partition_size.
	Check if partition size is greater than max_partition_size.
	* lto.c (do_whole_program_analysis): Adjust calls to
	lto_balanced_map() to pass 2nd argument.

From-SVN: r235478
2016-04-27 10:46:16 +00:00
H.J. Lu ea913779b0 Set flag_pic to flag_pie for PIE in LTO
Since PIE implies PIC, we should set flag_pic to flag_pie for PIE in
LTO.

	PR lto/70258
	* lto-lang.c (lto_post_options): Set flag_pic to flag_pie for
	PIE.

From-SVN: r234284
2016-03-17 04:07:10 -07:00
Jakub Jelinek 56aae4b7c0 ipa-polymorphic-call.c (walk_ssa_copies): Fix spelling - becuase -> because.
* ipa-polymorphic-call.c (walk_ssa_copies): Fix spelling
	- becuase -> because.
	* ipa-reference.c (ignore_module_statics): Likewise.
	* cgraph.c (cgraph_node::get_body): Likewise.
	* ipa-inline.c (early_inliner): Likewise.
	* ipa-devirt.c (types_same_for_odr): Likewise.
	* tree-streamer-out.c (pack_ts_type_common_value_fields): Likewise.
	* config/i386/i386.h (ACCUMULATE_OUTGOING_ARGS): Likewise.
cp/
	* decl.c (duplicate_decls): Fix spelling - becuase -> because.
lto/
	* lto-symtab.h (lto_symtab_prevail_decl): Fix spelling
	- becuase -> because.

From-SVN: r234061
2016-03-08 18:49:34 +01:00
Tom de Vries ed5d948da9 Don't mark offload symbols with force_output in ltrans
2016-02-15  Tom de Vries  <tom@codesourcery.com>

	PR lto/69655
	* lto-cgraph.c (input_offload_tables): Add and handle bool parameter
	do_force_output.
	* lto-streamer.h (input_offload_tables): Add and handle bool parameter.

	* lto.c (read_cgraph_and_symbols): Call input_offload_tables with
	argument.

From-SVN: r233419
2016-02-15 09:30:31 +00:00
Martin Liska 4ecbadc728 HSA: simplify partitioning of HSA kernels and host impls.
* lto-partition.c (add_symbol_to_partition_1): Remove usage
	of hsa_summaries.
	* hsa.c (hsa_summary_t::link_functions): Create IPA_REF_ADDR
	reference for an HSA kernel and its host function.

From-SVN: r232871
2016-01-27 12:50:05 +00:00
Jan Hubicka e49d321f03 re PR lto/69136 (ICE in lto_symtab_prevailing_virtual_decl, at lto/lto-symtab.c:991)
PR lto/69136
	* lto-symtab.c (lto_symtab_prevailing_virtual_decl): Abstract
	decls have no assemblernames.
	* g++.dg/torture/pr69136.C: New testcase.

From-SVN: r232553
2016-01-19 11:59:58 +00:00
Martin Jambor b2b4005150 Merge of HSA
2016-01-19  Martin Jambor  <mjambor@suse.cz>
	    Martin Liska  <mliska@suse.cz>
	    Michael Matz <matz@suse.de>

libgomp/
	* plugin/Makefrag.am: Add HSA plugin requirements.
	* plugin/configfrag.ac (HSA_RUNTIME_INCLUDE): New variable.
	(HSA_RUNTIME_LIB): Likewise.
	(HSA_RUNTIME_CPPFLAGS): Likewise.
	(HSA_RUNTIME_INCLUDE): New substitution.
	(HSA_RUNTIME_LIB): Likewise.
	(HSA_RUNTIME_LDFLAGS): Likewise.
	(hsa-runtime): New configure option.
	(hsa-runtime-include): Likewise.
	(hsa-runtime-lib): Likewise.
	(PLUGIN_HSA): New substitution variable.
	Fill HSA_RUNTIME_INCLUDE and HSA_RUNTIME_LIB according to the new
	configure options.
	(PLUGIN_HSA_CPPFLAGS): Likewise.
	(PLUGIN_HSA_LDFLAGS): Likewise.
	(PLUGIN_HSA_LIBS): Likewise.
	Check that we have access to HSA run-time.
	* libgomp-plugin.h (offload_target_type): New element
	OFFLOAD_TARGET_TYPE_HSA.
	* libgomp.h (gomp_target_task): New fields firstprivate_copies and
	args.
	(bool gomp_create_target_task): Updated.
	(gomp_device_descr): Extra parameter of run_func and async_run_func,
	new field can_run_func.
	* libgomp_g.h (GOMP_target_ext): Update prototype.
	* oacc-host.c (host_run): Added a new parameter args.
	* target.c (calculate_firstprivate_requirements): New function.
	(copy_firstprivate_data): Likewise.
	(gomp_target_fallback_firstprivate): Use them.
	(gomp_target_unshare_firstprivate): New function.
	(gomp_get_target_fn_addr): Allow returning NULL for shared memory
	devices.
	(GOMP_target): Do host fallback for all shared memory devices.  Do not
	pass any args to plugins.
	(GOMP_target_ext): Introduce device-specific argument parameter args.
	Allow host fallback if device shares memory.  Do not remap data if
	device has shared memory.
	(gomp_target_task_fn): Likewise.  Also treat shared memory devices
	like host fallback for mappings.
	(GOMP_target_data): Treat shared memory devices like host fallback.
	(GOMP_target_data_ext): Likewise.
	(GOMP_target_update): Likewise.
	(GOMP_target_update_ext): Likewise.  Also pass NULL as args to
	gomp_create_target_task.
	(GOMP_target_enter_exit_data): Likewise.
	(omp_target_alloc): Treat shared memory devices like host fallback.
	(omp_target_free): Likewise.
	(omp_target_is_present): Likewise.
	(omp_target_memcpy): Likewise.
	(omp_target_memcpy_rect): Likewise.
	(omp_target_associate_ptr): Likewise.
	(gomp_load_plugin_for_device): Also load can_run.
	* task.c (GOMP_PLUGIN_target_task_completion): Free
	firstprivate_copies.
	(gomp_create_target_task): Accept new argument args and store it to
	ttask.
	* plugin/plugin-hsa.c: New file.

gcc/
	* Makefile.in (OBJS): Add new source files.
	(GTFILES): Add hsa.c.
	* common.opt (disable_hsa): New variable.
	(-Whsa): New warning.
	* config.in (ENABLE_HSA): New.
	* configure.ac: Treat hsa differently from other accelerators.
	(OFFLOAD_TARGETS): Define ENABLE_OFFLOADING according to
	$enable_offloading.
	(ENABLE_HSA): Define ENABLE_HSA according to $enable_hsa.
	* doc/install.texi (Configuration): Document --with-hsa-runtime,
	--with-hsa-runtime-include, --with-hsa-runtime-lib and
	--with-hsa-kmt-lib.
	* doc/invoke.texi (-Whsa): Document.
	(hsa-gen-debug-stores): Likewise.
	* lto-wrapper.c (compile_images_for_offload_targets): Do not attempt
	to invoke offload compiler for hsa acclerator.
	* opts.c (common_handle_option): Determine whether HSA offloading
	should be performed.
	* params.def (PARAM_HSA_GEN_DEBUG_STORES): New parameter.
	* builtin-types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.
	* gimple-low.c (lower_stmt): Also handle GIMPLE_OMP_GRID_BODY.
	* gimple-pretty-print.c (dump_gimple_omp_for): Also handle
	GF_OMP_FOR_KIND_GRID_LOOP.
	(dump_gimple_omp_block): Also handle GIMPLE_OMP_GRID_BODY.
	(pp_gimple_stmt_1): Likewise.
	* gimple-walk.c (walk_gimple_stmt): Likewise.
	* gimple.c (gimple_build_omp_grid_body): New function.
	(gimple_copy): Also handle GIMPLE_OMP_GRID_BODY.
	* gimple.def (GIMPLE_OMP_GRID_BODY): New.
	* gimple.h (enum gf_mask): Added GF_OMP_PARALLEL_GRID_PHONY,
	GF_OMP_FOR_KIND_GRID_LOOP, GF_OMP_FOR_GRID_PHONY and
	GF_OMP_TEAMS_GRID_PHONY.
	(gimple_statement_omp_single_layout): Updated comments.
	(gimple_build_omp_grid_body): New function.
	(gimple_has_substatements): Also handle GIMPLE_OMP_GRID_BODY.
	(gimple_omp_for_grid_phony): New function.
	(gimple_omp_for_set_grid_phony): Likewise.
	(gimple_omp_parallel_grid_phony): Likewise.
	(gimple_omp_parallel_set_grid_phony): Likewise.
	(gimple_omp_teams_grid_phony): Likewise.
	(gimple_omp_teams_set_grid_phony): Likewise.
	(gimple_return_set_retbnd): Also handle GIMPLE_OMP_GRID_BODY.
	* omp-builtins.def (BUILT_IN_GOMP_OFFLOAD_REGISTER): New.
	(BUILT_IN_GOMP_OFFLOAD_UNREGISTER): Likewise.
	(BUILT_IN_GOMP_TARGET): Updated type.
	* omp-low.c: Include symbol-summary.h, hsa.h and params.h.
	(adjust_for_condition): New function.
	(get_omp_for_step_from_incr): Likewise.
	(extract_omp_for_data): Moved parts to adjust_for_condition and
	get_omp_for_step_from_incr.
	(build_outer_var_ref): Handle GIMPLE_OMP_GRID_BODY.
	(fixup_child_record_type): Bail out if receiver_decl is NULL.
	(scan_sharing_clauses): Handle OMP_CLAUSE__GRIDDIM_.
	(scan_omp_parallel): Do not create child functions for phony
	constructs.
	(check_omp_nesting_restrictions): Handle GIMPLE_OMP_GRID_BODY.
	(scan_omp_1_op): Checking assert we are not remapping to
	ERROR_MARK.  Also also handle GIMPLE_OMP_GRID_BODY.
	(parallel_needs_hsa_kernel_p): New function.
	(expand_parallel_call): Register apprpriate parallel child
	functions as HSA kernels.
	(grid_launch_attributes_trees): New type.
	(grid_attr_trees): New variable.
	(grid_create_kernel_launch_attr_types): New function.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Call get_target_arguments instead of looking
	up for teams and thread limit.
	(grid_expand_omp_for_loop): New function.
	(grid_arg_decl_map): New type.
	(grid_remap_kernel_arg_accesses): New function.
	(grid_expand_target_kernel_body): New function.
	(expand_omp): Call it.
	(lower_omp_for): Do not emit phony constructs.
	(lower_omp_taskreg): Do not emit phony constructs but create for them
	a temporary variable receiver_decl.
	(lower_omp_taskreg): Do not emit phony constructs.
	(lower_omp_teams): Likewise.
	(lower_omp_grid_body): New function.
	(lower_omp_1): Call it.
	(grid_reg_assignment_to_local_var_p): New function.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Likewise.
	(execute_lower_omp): Call grid_gridify_all_targets.
	(make_gimple_omp_edges): Handle GIMPLE_OMP_GRID_BODY.
	* tree-core.h (omp_clause_code): Added OMP_CLAUSE__GRIDDIM_.
	(tree_omp_clause): Added union field dimension.
	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__GRIDDIM_.
	* tree.c (omp_clause_num_ops): Added number of arguments of
	OMP_CLAUSE__GRIDDIM_.
	(omp_clause_code_name): Added name of OMP_CLAUSE__GRIDDIM_.
	(walk_tree_1): Handle OMP_CLAUSE__GRIDDIM_.
	* tree.h (OMP_CLAUSE_GRIDDIM_DIMENSION): New.
	(OMP_CLAUSE_SET_GRIDDIM_DIMENSION): Likewise.
	(OMP_CLAUSE_GRIDDIM_SIZE): Likewise.
	(OMP_CLAUSE_GRIDDIM_GROUP): Likewise.
	* passes.def: Schedule pass_ipa_hsa and pass_gen_hsail.
	* tree-pass.h (make_pass_gen_hsail): Declare.
	(make_pass_ipa_hsa): Likewise.
	* ipa-hsa.c: New file.
	* lto-section-in.c (lto_section_name): Add hsa section name.
	* lto-streamer.h (lto_section_type): Add hsa section.
	* timevar.def (TV_IPA_HSA): New.
        * hsa-brig-format.h: New file.
	* hsa-brig.c: New file.
	* hsa-dump.c: Likewise.
	* hsa-gen.c: Likewise.
	* hsa.c: Likewise.
	* hsa.h: Likewise.
	* toplev.c (compile_file): Call hsa_output_brig.
	* hsa-regalloc.c: New file.

gcc/fortran/
	* types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.

gcc/lto/
	* lto-partition.c: Include "hsa.h"
	(add_symbol_to_partition_1): Put hsa implementations into the
	same partition as host implementations.

liboffloadmic/
	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_async_run): New
	unused parameter.
	(GOMP_OFFLOAD_run): Likewise.

include/
	* gomp-constants.h (GOMP_DEVICE_HSA): New macro.
	(GOMP_VERSION_HSA): Likewise.
	(GOMP_TARGET_ARG_DEVICE_MASK): Likewise.
	(GOMP_TARGET_ARG_DEVICE_ALL): Likewise.
	(GOMP_TARGET_ARG_SUBSEQUENT_PARAM): Likewise.
	(GOMP_TARGET_ARG_ID_MASK): Likewise.
	(GOMP_TARGET_ARG_NUM_TEAMS): Likewise.
	(GOMP_TARGET_ARG_THREAD_LIMIT): Likewise.
	(GOMP_TARGET_ARG_VALUE_SHIFT): Likewise.
	(GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES): Likewise.

From-SVN: r232549
2016-01-19 11:35:10 +01:00
Jan Hubicka 5803bd0127 re PR lto/69003 (Undefined reference with gcc -r incremental linking)
PR lto/69003
	* lto-partition.c (rename_statics): Fix pasto.

From-SVN: r232525
2016-01-18 15:58:06 +00:00
Richard Biener 13092f6198 re PR lto/69337 (Internal compiler error fortran c lto)
2016-01-18  Richard Biener  <rguenther@suse.de>

	PR lto/69337
	* lto-symtab.c (lto_symtab_merge): Return early for mismatched
	function vs. variable.

From-SVN: r232505
2016-01-18 12:19:31 +00:00
Richard Biener 3c4e91c903 re PR debug/69077 (omnetpp ICEs with -flto -g)
2016-01-12  Richard Biener  <rguenther@suse.de>

	PR lto/69077
	lto/
	* lto-symtab.c (lto_symtab_prevailing_virtual_decl): Properly
	merge TREE_ADDRESSABLE and DECL_POSSIBLY_INLINED flags.

	* g++.dg/lto/pr69077_0.C: New testcase.
	* g++.dg/lto/pr69077_1.C: Likewise.

From-SVN: r232272
2016-01-12 14:22:40 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jan Hubicka 3fddb2efc2 re PR middle-end/68878 (471.omnetpp in SPEC CPU 2006 is miscompiled with LTO)
PR lto/68878
	* lto-symtab.c (lto_symtab_prevailing_virtual_decl): New function.
	* lto-symtab.h (lto_symtab_prevailing_virtual_decl): Declare.
	(lto_symtab_prevailing_decl): Use it.

From-SVN: r231671
2015-12-16 04:58:13 +00:00
Ilya Verbin 4a38b02b4e c-common.c (c_common_attribute_table): Handle "omp declare target link" attribute.
gcc/c-family/
	* c-common.c (c_common_attribute_table): Handle "omp declare target
	link" attribute.
gcc/
	* cgraphunit.c (output_in_order): Do not assemble "omp declare target
	link" variables in ACCEL_COMPILER.
	* gimplify.c (gimplify_adjust_omp_clauses): Do not remove mapping of
	"omp declare target link" variables.
	* omp-low.c (scan_sharing_clauses): Do not remove mapping of "omp
	declare target link" variables.
	(add_decls_addresses_to_decl_constructor): For "omp declare target link"
	variables output address of the artificial pointer instead of address of
	the variable.  Set most significant bit of the size to mark them.
	(pass_data_omp_target_link): New pass_data.
	(pass_omp_target_link): New class.
	(find_link_var_op): New static function.
	(make_pass_omp_target_link): New function.
	* passes.def: Add pass_omp_target_link.
	* tree-pass.h (make_pass_omp_target_link): Declare.
	* varpool.c (symbol_table::output_variables): Do not assemble "omp
	declare target link" variables in ACCEL_COMPILER.
gcc/lto/
	* lto.c: Include stringpool.h and fold-const.h.
	(offload_handle_link_vars): New static function.
	(lto_main): Call offload_handle_link_vars.
libgomp/
	* libgomp.h (REFCOUNT_LINK): Define.
	(struct splay_tree_key_s): Add link_key.
	* target.c (gomp_map_vars): Treat REFCOUNT_LINK objects as not mapped.
	Replace target address of the pointer with target address of newly
	mapped object in the splay tree.  Set link pointer on target to the
	device address of the mapped object.
	(gomp_unmap_vars): Restore target address of the pointer in the splay
	tree for REFCOUNT_LINK objects after unmapping.
	(gomp_load_image_to_device): Set refcount to REFCOUNT_LINK for "omp
	declare target link" objects.
	(gomp_unload_image_from_device): Replace j with i.  Force unmap of all
	"omp declare target link" objects, which were mapped for the image.
	(gomp_exit_data): Restore target address of the pointer in the splay
	tree for REFCOUNT_LINK objects after unmapping.
	* testsuite/libgomp.c/target-link-1.c: New file.

From-SVN: r231655
2015-12-15 14:56:50 +00:00
Jan Hubicka ca83487662 cgraph.c (cgraph_node::get_untransformed_body): Pass compressed flag to lto_get_section_data.
* cgraph.c (cgraph_node::get_untransformed_body): Pass compressed
	flag to lto_get_section_data.
	* varpool.c (varpool_node::get_constructor): Likewise.
	* lto-section-in.c (lto_get_section_data): Add new flag decompress.
	(lto_free_section_data): Likewise.
	(lto_get_raw_section_data): New function.
	(lto_free_raw_section_data): New function.
	(copy_function_or_variable): Copy sections w/o decompressing.
	(lto_output_decl_state_refs): Picke compressed bit.
	* lto-streamer.h (lto_in_decl_state): New flag compressed.
	(lto_out_decl_state): Likewise.
	(lto_get_section_data, lto_free_section_data): Update prototypes
	(lto_get_raw_section_data, lto_free_raw_section_data): Declare.
	(lto_write_raw_data): Declare.
	(lto_begin_section): Remove FIXME.
	(lto_write_raw_data): New function.
	(lto_write_stream): Remove FIXME.
	(lto_new_out_decl_state): Set compressed flag.

	* lto.c (lto_read_in_decl_state): Unpickle compressed bit.

From-SVN: r231593
2015-12-13 02:12:15 +00:00
Jan Hubicka 958a627f88 re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
	* lto-symtab.c (lto_symtab_merge_p): Avoid merging across different
	values of error and warning attributes.
	* gcc.dg/lto/pr61886_0.c: New testcase

From-SVN: r231548
2015-12-10 23:57:15 +00:00
Jan Hubicka da20571a7c re PR lto/68811 (ICE: in get, at cgraph.h:1218)
PR lto/68811
	* lto.c (lto_fixup_prevailing_decls): Do not check TREE_CHAIN of
	DECL.
	(LTO_NO_PREVAIL): Use gcc_checking_assert.

From-SVN: r231477
2015-12-09 22:37:02 +00:00
Jan Hubicka 378004b9d2 re PR lto/68811 (ICE: in get, at cgraph.h:1218)
PR lto/68811
	* g++.dg/lto/pr68811_0.C: New testcase.
	* g++.dg/lto/pr68811_1.C: New testcase.

	* lto-symtab.c (lto_symtab_merge_decls_2): Decl can never be prevailed
	by itself.

From-SVN: r231473
2015-12-09 19:35:18 +00:00
Jan Hubicka 6b9ac1796e re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
	* lto-streamer.h (lto_symtab_merge_decls, lto_symtab_merge_symbols,
	lto_symtab_prevailing_decl): MOve to lto-symtab.h.
	* lto-streamer-out.c (DFS::DFS_write_tree_body): Check that
	DECL_ABSTRACT_ORIGIN is not error_mark_node.

	* lto-symtab.c: Include lto-symtab.h.
	(lto_cgraph_replace_node): Do not merge profiles here.
	(lto_symtab_merge_p): New function.
	(lto_symtab_merge_decls_2): Honor lto_symtab_merge_p.
	(lto_symtab_merge_symbols_1): Turn unmerged decls into transparent
	aliases.
	(lto_symtab_merge_symbols): Do not clear node->aux; we no longer use it.
	(lto_symtab_prevailing_decl): Move to lto-symtab.h; rewrite.
	* lto.c: Include lto-symtab.h
	* lto-symtab.h: New.

From-SVN: r231438
2015-12-09 02:15:05 +00:00
Jan Hubicka 41c60c6c75 re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
	* lto-partition.c (add_symbol_to_partition_1): Transparent aliases
	are not part of the definition.
	(contained_in_symbol): Likewise.
	(promote_symbol): When promoting a symbol also promote all transparent
	aliases.
	(rename_statics): Weakref needs unique name, too.

From-SVN: r231425
2015-12-08 20:46:42 +00:00
Jan Hubicka 71e546870c re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
	* symtab.c (ultimate_transparent_alias_target): New inline function.
	(symbol_table::assembler_names_equal_p): New method; break out from ...
	(symbol_table::decl_assembler_name_equal): ... here.
	(symbol_table::change_decl_assembler_name): Also update names and
	translation links of transparent aliases.
	(symtab_node::dump_base): Dump transparent_alias.
	(symtab_node::verify_base): Implement basic transparent alias
	verification.
	(symtab_node::make_decl_local): Support localization of weakrefs;
	recurse to transparent aliases; set TREE_STATIC.
	(symtab_node::ultimate_alias_target_1): Handle visibility of
	transparent aliases.
	(symtab_node::resolve_alias): New parmaeter transparent; handle
	transparent aliases; recurse to aliases of aliases to fix comdat
	groups.
	(symtab_node::get_partitioning_class): Handle transparent aliases.
	* ipa-visibility.c (cgraph_externally_visible_p,
	varpool_node::externally_visible_p): Visibility of transparent alias
	depends on its target.
	(function_and_variable_visibility): Do not tweak visibility of
	transparent laiases.
	(function_and_variable_visibility): Likewise.
	* ipa.c (symbol_table::remove_unreachable_nodes): Clear
	transparent_alias flag.
	* alias.c (cgraph_node::create_alias, cgraph_node::get_availability):
	Support transparent aliases.
	* cgraph.h (symtab_node): Update prototype of resolve_alias;
	add transparent_alias flag.
	(symbol_table: Add assembler_names_equal_p.
	(symtab_node::real_symbol_p): Skip transparent aliases.
	* cgraphunit.c (cgraph_node::reset): Reset transparent_alias flag.
	(handle_alias_pairs): Set transparent_alias for weakref.
	(cgraph_node::assemble_thunks_and_aliases): Do not asemble transparent
	aliases.
	* lto-cgraph.c (lto_output_node): When outputting same_comdat_group
	skip symbols not put into boundary; stream transparent_alias.
	(lto_output_varpool_node): Likewise.
	(input_overwrite_node, input_varpool_node): Stream transparent alias.
	* varpool.c (ctor_for_folding, varpool_node::get_availability,
	varpool_node::assemble_aliases,
	symbol_table::remove_unreferenced_decls): Handle transparent aliase.
	(varpool_node::create_alias): Set transparent_alias.

	* lto-partition.c (add_symbol_to_partition_1, contained_in_symbol,
	rename_statics, rename_statics): Handle transparent aliases.

From-SVN: r231373
2015-12-07 17:36:54 +00:00
Jan Hubicka 88636b62bc * ipa-inline.c (can_inline_edge_p) Use merged_comdat.
* cgraphclones.c (cgraph_node::create_clone): Use merged_comdat.
	* cgraph.c (cgraph_node::dump): Dump merged_comdat.
	* ipa-icf.c (sem_function::merge): Drop merged_comdat when merging
	comdat and non-comdat.
	* cgraph.h (cgraph_node): Rename merged to merged_comdat.
	* ipa-inline-analysis.c (simple_edge_hints): Check both merged_comdat
	and icf_merged.

	* lto-symtab.c (lto_cgraph_replace_node): Update code computing
	merged_comdat.

From-SVN: r231291
2015-12-04 18:02:26 +00:00