Commit Graph

186387 Commits

Author SHA1 Message Date
Pascal Obry
0bc7cf47c1 [Ada] Add some OS constants to control keepalive on TCP connections
gcc/ada/

	* s-oscons-tmplt.c: Add some OS constants.
2021-06-29 14:23:46 +00:00
Piotr Trojanek
d23455ce23 [Ada] Rewrite Validated_View in recursive style
gcc/ada/

	* sem_util.ads (Validated_View): Fix style in comment.
	* sem_util.adb (Validated_View): Rewrite in recursive style.
2021-06-29 14:23:46 +00:00
Eric Botcazou
d94afa43f7 [Ada] Ignore again errors when running gen_il-main
gcc/ada/

	* Make-generated.in (ada/stamp-gen_il): Ignore errors from
	running gen_il-main.
2021-06-29 14:23:46 +00:00
Richard Kenner
bb456e80c1 [Ada] Factor out many fields in entities
gcc/ada/

	* gen_il-gen-gen_entities.adb (Record_Field_Kind,
	Allocatable_Kind): Add new abstract kinds.
	(Constant_Or_Variable_Kind): Likewise.
	(E_Constant, E_Variable, E_Loop_Parameter): Use them.
	(E_Discriminant, E_Component): Likewise.
	* gen_il-types.ads (type Opt_Type_Enum): Add them.
2021-06-29 14:23:46 +00:00
Bob Duff
997d3894fb [Ada] Fix bug in node/entity kind numbers in sinfo/einfo.h
gcc/ada/

	* gen_il-gen.adb (Put_C_Type_And_Subtypes): Put the correct
	numbers.
	* gen_il-internals.ads, gen_il-internals.adb: (Pos): Remove this
	function. It was assuming that the order of the enumeration
	literals in Type_Enum is the same as the order of the generated
	types Node_Kind and Entity_Kind, which is not true.
2021-06-29 14:23:45 +00:00
Piotr Trojanek
10215ba9d7 [Ada] Consistently use Validated_View for Valid_Scalars on records
gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Explicitly use
	Validated_View for record objects.
2021-06-29 14:23:45 +00:00
Richard Biener
6df6055d5c Add forward propagation to SLP "any" permutes
This adds a forward propagation phase to the permute optimization
machinery which allows us to handle "any" permute for all kinds of
nodes.  To match previous behavior cost-wise we still do not allow
non-external/constant nodes to be duplicated for multiple permutes
and this is ensured during propagation itself.

2021-06-29  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_optimize_slp): Forward propagate
	to "any" permute nodes and relax "any" permute proapgation
	during iterative backward propagation.
2021-06-29 16:20:14 +02:00
Tobias Burnus
33c4e46624 Add 'default' to -foffload=; document that flag [PR67300]
As -foffload={options,targets,targets=options} is very convoluted,
it has been split into -foffload=targets (supporting the old syntax
for backward compatibilty) and -foffload-options={options,target=options}.

Only the new syntax is documented.

Additionally, -foffload=default is supported, which can reset the
devices after -foffload=disable / -foffload=targets to the default,
if needed.

gcc/ChangeLog:

	PR other/67300
	* common.opt (-foffload=): Update description.
	(-foffload-options=): New.
	* doc/invoke.texi (C Language Options): Document
	-foffload and -foffload-options.
	* gcc.c (check_offload_target_name): New, split off from
	handle_foffload_option.
	(check_foffload_target_names): New.
	(handle_foffload_option): Handle -foffload=default.
	(driver_handle_option): Update for -foffload-options.
	* lto-opts.c (lto_write_options): Use -foffload-options
	instead of -foffload.
	* lto-wrapper.c (merge_and_complain, append_offload_options):
	Likewise.
	* opts.c (common_handle_option): Likewise.

libgomp/ChangeLog:

	PR other/67300
	* testsuite/libgomp.c-c++-common/reduction-16.c: Replace
	-foffload=nvptx-none= by -foffload-options=nvptx-none= to
	avoid disabling other offload targets.
	* testsuite/libgomp.c-c++-common/reduction-5.c: Likewise.
	* testsuite/libgomp.c-c++-common/reduction-6.c: Likewise.
	* testsuite/libgomp.c/target-44.c: Likewise.
2021-06-29 16:00:04 +02:00
Tobias Burnus
489c5dcf7b libgomp.fortran/defaultmap-8.f90: Fix non-shared memory handling
Disable some more parts of the test as firstprivate does not work yet
due to PR fortran/90742.

libgomp/
	* testsuite/libgomp.fortran/defaultmap-8.f90 (bar): Determine whether
	target has shared memory and disable some scalar pointer/allocatable
	checks if not as firstprivate does not work.
2021-06-29 15:50:23 +02:00
Tobias Burnus
d479ddc0d9 doc/invoke.texi: Sort flags in 'C Language Options'
As discussed during the review of
'[Patch] Add 'default' to -foffload=; document that flag [PR67300]'.

gcc/ChangeLog:

	* doc/invoke.texi (C Language Options): Sort options
	alphabetically in optlist and also the description itself.
	Remove leftover -fallow-single-precision from and add missing
	-fgnu-tm to the optlist.
2021-06-29 14:40:43 +02:00
Richard Biener
2dfc0f2203 Refactor SLP permute opt propagation
This rewrites the SLP permute opt propagation to elide the visited
bit for an incoming permute of -1 as well as allowing the initial
propagation to take more than one iteration before starting on
materialization.  As we still lack propagation in the reverse
direction I've added gcc.dg/vect/bb-slp-71.c and a stopgap to
restrict "any" permute handling to the supported cases.

2021-06-29  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (slpg_vertex::visited): Remove.
	(vect_slp_perms_eq): Handle -1 permutes.
	(vect_optimize_slp): Rewrite permute propagation.

	* gcc.dg/vect/pr67790.c: Un-XFAIL.
	* gcc.dg/vect/bb-slp-71.c: New testcase.
2021-06-29 13:10:36 +02:00
Jakub Jelinek
53fd7544af match.pd: Avoid (intptr_t)x eq/ne CST to x eq/ne (typeof x) CST opt in GENERIC when sanitizing [PR101210]
When we have (intptr_t) x == cst where x has REFERENCE_TYPE, this
optimization creates x == cst out of it where cst has REFERENCE_TYPE.
If it is done in GENERIC folding, it can results in ubsan failures
where the INTEGER_CST with REFERENCE_TYPE is instrumented.

Fixed by deferring it to GIMPLE folding in this case.

2021-06-29  Jakub Jelinek  <jakub@redhat.com>

	PR c++/101210
	* match.pd ((intptr_t)x eq/ne CST to x eq/ne (typeof x) CST): Don't
	perform the optimization in GENERIC when sanitizing and x has a
	reference type.

	* g++.dg/ubsan/pr101210.C: New test.
2021-06-29 11:24:38 +02:00
Richard Biener
c01760bc54 tree-optimization/101242 - fix reverse graph entry detection
This avoids detecting random unrelated nodes as possible entries
to not backwards reachable regions of the SLP graph.  Instead
explicitely add the problematic nodes.

This temporary XFAILs gcc.dg/vect/pr67790.c until I get the
permute propagation adjusted to when it needs more than one
optimistic iteration.

2021-06-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101242
	* tree-vect-slp.c (vect_slp_build_vertices): Force-add
	PHIs with not represented initial values as leafs.

	* gcc.dg/vect/bb-slp-pr101242.c: New testcase.
	* gcc.dg/vect/pr67790.c: XFAIL scan for zero VEC_PERM_EXPR.
2021-06-29 10:34:57 +02:00
Jan-Benedict Glaw
dc6866b033 pdp11: Fix signednedd warnings, remove "register" keywords
gcc/ChangeLog:
	* config/pdp11/pdp11.h (ASM_OUTPUT_SKIP): Fix signedness warning.
	* config/pdp11/pdp11.c (pdp11_asm_print_operand_punct_valid_p): Remove
	"register" keyword.
	(pdp11_initial_elimination_offset) Remove unused variable.
	(pdp11_cmp_length) Ditto.
	(pdp11_insn_cost): Ditto, and fix signedness warning.
2021-06-29 09:26:56 +02:00
David Edelsohn
095a01cf6e bootstrap: Include tm_p.h in btfout.c and ctfout.c.
btfout.c and ctfout.c reference target-specific macros that
may reference target-specific functions that are declared in a
target-specific header.  tm_p.h must be included to provide the
target-specific header.

gcc/ChangeLog:

	* btfout.c: Include tm_p.h.
	* ctfout.c: Same.
2021-06-28 22:59:54 -04:00
GCC Administrator
c8abc2058e Daily bump. 2021-06-29 00:16:42 +00:00
David Malcolm
7c6b354b92 analyzer: introduce byte_range and use to simplify dumps
gcc/analyzer/ChangeLog:
	* analyzer.h (byte_offset_t): New typedef.
	* store.cc (bit_range::dump_to_pp): Dump as a byte range if
	possible.
	(bit_range::as_byte_range): New.
	(byte_range::dump_to_pp): New.
	* store.h (class byte_range): New forward decl.
	(struct bit_range): Add comment.
	(bit_range::as_byte_range): New decl.
	(struct byte_range): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-28 19:18:06 -04:00
Martin Sebor
40c64c9ea5 Regression tests for TREE_NO_WARNING enhancement to warning groups [PR74765, PR74762].
PR middle-end/74765 - missing uninitialized warning (parenthesis, TREE_NO_WARNING abuse)
PR middle-end/74762 - [9/10/11/12 Regression] missing uninitialized warning (C++, parenthesized expr, TREE_NO_WARNING)

gcc/testsuite/ChangeLog:

	* g++.dg/uninit-pr74762.C: New test.
	* g++.dg/warn/uninit-pr74765.C: Same.
2021-06-28 15:14:50 -06:00
Martin Sebor
ed94172c7e objc: Add support for per-location warning groups.
gcc/objc/ChangeLog:

	* objc-act.c (objc_maybe_build_modify_expr): Replace direct uses
	of TREE_NO_WARNING with warning_suppressed_p, and suppress_warning.
	(objc_build_incr_expr_for_property_ref): Same.
	(objc_build_struct): Same.
	(synth_module_prologue): Same.
	* objc-gnu-runtime-abi-01.c (gnu_runtime_01_initialize): Same.
	* objc-next-runtime-abi-01.c (next_runtime_01_initialize): Same.
	* objc-next-runtime-abi-02.c (next_runtime_02_initialize): Same.
2021-06-28 15:13:17 -06:00
Martin Sebor
3f44889076 libcc1: Add support for per-location warning groups.
libcc1/ChangeLog:

	* libcp1plugin.cc (record_decl_address): Replace a direct use
	of TREE_NO_WARNING with suppress_warning.
2021-06-28 15:09:46 -06:00
Martin Sebor
d5e69948be fortran: Add support for per-location warning groups.
gcc/fortran/ChangeLog:

	* trans-array.c (trans_array_constructor): Replace direct uses
	of TREE_NO_WARNING with warning_suppressed_p, and suppress_warning.
	* trans-decl.c (gfc_build_qualified_array): Same.
	(gfc_build_dummy_array_decl): Same.
	(generate_local_decl): Same.
	(gfc_generate_function_code): Same.
	* trans-openmp.c (gfc_omp_clause_default_ctor): Same.
	(gfc_omp_clause_copy_ctor): Same.
	* trans-types.c (get_dtype_type_node): Same.
	(gfc_get_desc_dim_type): Same.
	(gfc_get_array_descriptor_base): Same.
	(gfc_get_caf_vector_type): Same.
	(gfc_get_caf_reference_type): Same.
	* trans.c (gfc_create_var_np): Same.
2021-06-28 14:47:21 -06:00
Martin Sebor
8c7dfbb8f3 ada: Add support for per-location warning groups.
gcc/ada/ChangeLog:

	* gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu):
	Replace TREE_NO_WARNING with suppress_warning.
	(gnat_gimplify_expr): Same.
	* gcc-interface/utils.c (gnat_pushdecl): Same.
2021-06-28 14:18:06 -06:00
Ian Lance Taylor
42ff474e28 libbacktrace: improve XCOFF support
libbacktrace/ChangeLog:
2021-06-28  Clément Chigot  <clement.chigot@atos.net>

	* xcoff.c (SSUBTYP_DWRNGES): New define.
	(xcoff_add): Use correct XCOFF DWARF section subtype
	for DEBUG_RANGES. Remove lineoff workaround.
	Adjust base_address.
	(xcoff_initialize_syminfo): Adapt to new base_address.
	(xcoff_lookup_pc): Likewise.
	(xcoff_initialize_fileline): Likewise.
2021-06-28 10:36:34 -07:00
Indu Bhagat
9c93f6cc95 libiberty: copy over .BTF section when using LTO
libiberty/ChangeLog:

	* simple-object.c (handle_lto_debug_sections): Copy over .BTF section.
2021-06-28 18:47:21 +02:00
Indu Bhagat
d5cf2b5db3 Enable BTF generation in the BPF backend
This patch changes the BPF GCC backend in order to use the DWARF debug
hooks and therefore enables the user to generate BTF debugging
information with -gbtf.  Generating BTF is crucial when compiling BPF
programs, since the CO-RE (compile-once, run-everwhere) mechanism
used by the kernel BPF loader relies on it.

Note that since in eBPF it is not possible to unwind frames due to the
restrictive nature of the target architecture, we are disabling the
generation of CFA in this target.

2021-06-28  David Faust <david.faust@oracle.com>

	* config/bpf/bpf.c (bpf_expand_prologue): Do not mark insns as
	frame related.
	(bpf_expand_epilogue): Likewise.
	* config/bpf/bpf.h (DWARF2_FRAME_INFO): Define to 0.
	Do not define DBX_DEBUGGING_INFO.
2021-06-28 18:47:21 +02:00
Indu Bhagat
824a6a52a6 CTF/BTF documentation
This commit documents the new command line options introduced by the
CTF and BTF debug formats.

2021-06-28  Indu Bhagat  <indu.bhagat@oracle.com>

	* doc/invoke.texi: Document the CTF and BTF debug info options.
2021-06-28 18:47:21 +02:00
Indu Bhagat
c1f76af469 CTF/BTF testsuites
This commit adds a new testsuite for the CTF debug format.

2021-06-28  Indu Bhagat  <indu.bhagat@oracle.com>
	    David Faust  <david.faust@oracle.com>

gcc/testsuite/

	* lib/gcc-dg.exp (gcc-dg-frontend-supports-ctf): New procedure.
	(gcc-dg-debug-runtest): Add -gctf support.
	* gcc.dg/debug/btf/btf-1.c: New test.
	* gcc.dg/debug/btf/btf-2.c: Likewise.
	* gcc.dg/debug/btf/btf-anonymous-struct-1.c: Likewise.
	* gcc.dg/debug/btf/btf-anonymous-union-1.c: Likewise.
	* gcc.dg/debug/btf/btf-array-1.c: Likewise.
	* gcc.dg/debug/btf/btf-bitfields-1.c: Likewise.
	* gcc.dg/debug/btf/btf-bitfields-2.c: Likewise.
	* gcc.dg/debug/btf/btf-bitfields-3.c: Likewise.
	* gcc.dg/debug/btf/btf-cvr-quals-1.c: Likewise.
	* gcc.dg/debug/btf/btf-enum-1.c: Likewise.
	* gcc.dg/debug/btf/btf-forward-1.c: Likewise.
	* gcc.dg/debug/btf/btf-function-1.c: Likewise.
	* gcc.dg/debug/btf/btf-function-2.c: Likewise.
	* gcc.dg/debug/btf/btf-int-1.c: Likewise.
	* gcc.dg/debug/btf/btf-pointers-1.c: Likewise.
	* gcc.dg/debug/btf/btf-struct-1.c: Likewise.
	* gcc.dg/debug/btf/btf-typedef-1.c: Likewise.
	* gcc.dg/debug/btf/btf-union-1.c: Likewise.
	* gcc.dg/debug/btf/btf-variables-1.c: Likewise.
	* gcc.dg/debug/btf/btf.exp: Likewise.
	* gcc.dg/debug/ctf/ctf-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-anonymous-struct-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-anonymous-union-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-array-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-array-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-array-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-array-4.c: Likewise.
	* gcc.dg/debug/ctf/ctf-attr-mode-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-attr-used-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-bitfields-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-bitfields-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-bitfields-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-bitfields-4.c: Likewise.
	* gcc.dg/debug/ctf/ctf-complex-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-cvr-quals-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-cvr-quals-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-cvr-quals-4.c: Likewise.
	* gcc.dg/debug/ctf/ctf-enum-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-enum-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-file-scope-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-float-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-forward-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-forward-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-func-index-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-function-pointers-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-function-pointers-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-function-pointers-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-functions-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-int-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-objt-index-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-pointers-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-pointers-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-preamble-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-4.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-5.c: Likewise.
	* gcc.dg/debug/ctf/ctf-skip-types-6.c: Likewise.
	* gcc.dg/debug/ctf/ctf-str-table-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-struct-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-struct-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-struct-array-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-struct-pointer-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-struct-pointer-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-struct-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-struct-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf-typedef-struct-3.c: Likewise.
	* gcc.dg/debug/ctf/ctf-union-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-variables-1.c: Likewise.
	* gcc.dg/debug/ctf/ctf-variables-2.c: Likewise.
	* gcc.dg/debug/ctf/ctf.exp: Likewise.
2021-06-28 18:47:21 +02:00
Indu Bhagat
b7e215a8ee CTF/BTF debug formats
This commit introduces support for generating CTF debugging
information and BTF debugging information from GCC.

2021-06-28  Indu Bhagat  <indu.bhagat@oracle.com>
	    David Faust  <david.faust@oracle.com>
	    Jose E. Marchesi  <jose.marchesi@oracle.com>
	    Weimin Pan  <weimin.pan@oracle.com>

gcc/

	* Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to
	GTFILES.  Add new object files.
	* common.opt: Add CTF and BTF debug info options.
	* btfout.c: New file.
	* ctfc.c: Likewise.
	* ctfc.h: Likewise.
	* ctfout.c: Likewise.
	* dwarf2ctf.c: Likewise.
	* dwarf2ctf.h: Likewise.
	* dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and
	BTF_DEBUG.
	* dwarf2out.c (dwarf2out_source_line): Likewise.
	(dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to
	be generated.
	(debug_format_do_cu): New function.
	(dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for
	them if	requested.
	Include dwarf2ctf.c.
	* final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug
	formats.
	* flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG.
	(CTF_DEBUG): New bitmask.
	(BTF_DEBUG): Likewise.
	(enum ctf_debug_info_levels): New enum.
	* gengtype.c (open_base_files): Handle ctfc.h.
	(main): Handle uint32_t type.
	* flags.h (btf_debuginfo_p): New definition.
	(dwarf_based_debuginfo_p): Likewise.
	* opts.c (debug_type_names): Add entries for CTF and BTF.
	(btf_debuginfo_p): New function.
	(dwarf_based_debuginfo_p): Likewise.
	(common_handle_option): Handle -gctfN and -gbtf options.
	(set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate.
	* toplev.c (process_options): Inform the user and ignore -gctfLEVEL if
	frontend is not C.

include/

	* ctf.h: New file.
	* btf.h: Likewise.

libiberty/

	* simple-object.c (handle_lto_debug_sections): Copy over .ctf
	sections.
2021-06-28 18:47:20 +02:00
Indu Bhagat
532617d636 dejagnu: modularize gcc-dg-debug-runtest a bit
Move some functionality into a procedure of its own. This is only so that when
the patch for ctf comes along, the gcc-dg-debug-runtest procedure looks bit
more uniform.

gcc/testsuite/ChangeLog:

	* lib/gcc-dg.exp (gcc-dg-target-supports-debug-format): New procedure.
2021-06-28 18:47:20 +02:00
Indu Bhagat
5783a0cc78 dwarf: externalize some DWARF internals for needs of CTF/BTF
This patch externalizes some internal DIE structures and their attributes
for the use of DWARF-based debug formats like CTF and BTF.

The following functions which were previously defined as static in
dwarf2out.c are now non-static, and extern prototypes for them have
been added to dwarf2out.h:

- get_AT
- AT_int
- AT_class
- AT_loc
- get_AT_ref
- get_AT_string
- get_AT_class
- AT_unsigned
- get_AT_unsigned
- get_AT_flag
- add_name_attribute
- new_die_raw
- base_type_die
- lookup_decl_die
- get_AT_file

Note how this patch doens't change the names of these functions to
avoid a massive renaming in dwarf2out.c, but in the future we probably
want these functions to sport a dw_* prefix.

Also, some type definitions have been moved from dwarf2out.c to
dwarf2out.h:

- dw_attr_node
- struct dwarf_file_data

Finally, three new accessor functions have been added to dwarf2out.c
with prototypes in dwarf2out.h:

- dw_get_die_child
- dw_get_die_sib
- dw_get_die_tag

2021-06-28  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* dwarf2out.c (AT_class): Function is no longer static.
	(AT_int): Likewise.
	(AT_unsigned): Likewise.
	(AT_loc): Likewise.
	(get_AT): Likewise.
	(get_AT_string): Likewise.
	(get_AT_flag): Likewise.
	(get_AT_unsigned): Likewise.
	(get_AT_ref): Likewise.
	(new_die_raw): Likewise.
	(lookup_decl_die): Likewise.
	(base_type_die): Likewise.
	(add_name_attribute): Likewise.
	(add_AT_int): Likewise.
	(add_AT_unsigned): Likewise.
	(add_AT_loc): Likewise.
	(dw_get_die_tag): New function.
	(dw_get_die_child): Likewise.
	(dw_get_die_sib): Likewise.
	(struct dwarf_file_data): Move from here to dwarf2out.h
	(struct dw_attr_struct): Likewise.
	* dwarf2out.h: Analogous changes.
2021-06-28 18:47:20 +02:00
Martin Jambor
2902991a6b
ipa-sra: Introduce a mini-DCE to tree-inline.c (PR 93385)
I was asked by Richi to split my fix for PR 93385 for easier review
into IPA-SRA materialization refactoring and the actual DCE addition.
This is the second part that actually contains the DCE of statements
that IPA-SRA should not leave behind because they can have problematic
side effects, even if they are useless, so that we do not depend on
tree-dce to remove them for correctness.

The patch fixes the problem by doing a def-use walk when materializing
clones, marking which statements should not be copied and which
SSA_NAMEs do not need to be computed because eventually they would be
DCEd.  We do this on the original function body and tree-inline simply
does not copy statements which are "dead."

The only complication is removing dead argument calls because that
needs to be communicated to callee redirection code using the
infrastructure introduced by the previous patch.

I added all testcases of the original patch to this one, although some
probably test behavior introduced in the previous patch.

gcc/ChangeLog:

2021-05-12  Martin Jambor  <mjambor@suse.cz>

	PR ipa/93385
	* ipa-param-manipulation.h (class ipa_param_body_adjustments): New
	members m_dead_stmts and m_dead_ssas.
	* ipa-param-manipulation.c
	(ipa_param_body_adjustments::mark_dead_statements): New function.
	(ipa_param_body_adjustments::common_initialization): Call it on
	all removed but not split parameters.
	(ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize
	new mwmbers.
	(ipa_param_body_adjustments::modify_call_stmt): Remove arguments that
	are dead.
	* tree-inline.c (remap_gimple_stmt): Do not copy dead statements, reset
	dead debug statements.
	(copy_phis_for_bb): Do not copy dead PHI nodes.

gcc/testsuite/ChangeLog:

2021-03-22  Martin Jambor  <mjambor@suse.cz>

	PR ipa/93385
	* gcc.dg/ipa/pr93385.c: New test.
	* gcc.dg/ipa/ipa-sra-23.c: Likewise.
	* gcc.dg/ipa/ipa-sra-24.c: Likewise.
	* g++.dg/ipa/ipa-sra-4.C: Likewise.
2021-06-28 18:24:54 +02:00
Martin Jambor
87467f45e8
ipa-sra: Restructure how cloning and call redirection communicate (PR 93385)
I was asked by Richi to split my fix for PR 93385 for easier review
into IPA-SRA materialization refactoring and the actual DCE addition.
Fortunately it was mostly natural except for a temporary weird
condition in ipa_param_body_adjustments::modify_call_stmt.
Additionally.  In addition to the patch I posted previously, this one
also deallocated the newly added summary in toplev::finalize and fixes
a mistakenly uninitialized field.

This is the first part which basically replaces performed_splits in
clone_info and the code which generates it, keeps it up-to-date and
consumes it with new edge summaries which are much nicer.  It simply
contains 1) a mapping from the original argument indices to the actual
indices in the call statement as it is now, 2) information needed to
identify arguments representing pass-through IPA-SRA splits with which
have been added to the call arguments in place of an original
argument/reference and 3) a delta to the index where va_args may start
- so basically directly all the information that the consumer of
performed_splits had to compute and we also do not need the weird
dummy declarations.

The main disadvantage is that the information has to be created (and
kept up-to-date) for all call graph edges associated with the given
statement from all clones (including inline clones) of the clone where
splitting or removal happened first.  But all of this happens during
clone materialization so the only effect on WPA memory consumption is
the removal of a pointer from clone_info.

The statement modification code also has to know the statement from
the original function in order to be able to locate the edge summaries
which at this point are still keyed to these.  However, the code is
already quite heavily dependant on how things are structured in
tree-inline.c and in order to fix bugs like these it probably has to
be.

The subsequent patch needs this new information to be able to remove
arguments from calls during materialization and communicate this
information to the call redirection.

gcc/ChangeLog:

2021-05-17  Martin Jambor  <mjambor@suse.cz>

	PR ipa/93385
	* symtab-clones.h (clone_info): Removed member param_adjustments.
	* ipa-param-manipulation.h: Adjust initial comment to reflect how we
	deal with pass-through splits now.
	(ipa_param_performed_split): Removed.
	(ipa_param_adjustments::modify_call): Adjusted parameters.
	(class ipa_param_body_adjustments): Adjusted parameters of
	register_replacement, modify_gimple_stmt and modify_call_stmt.
	(ipa_verify_edge_has_no_modifications): Declare.
	(ipa_edge_modifications_finalize): Declare.
	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Remove
	performed_splits processing, pas only edge to padjs->modify_call,
	check that call arguments were not modified if they should not have
	been.
	* cgraphclones.c (cgraph_node::create_clone): Do not copy performed
	splits.
	* ipa-param-manipulation.c (struct pass_through_split_map): New type.
	(ipa_edge_modification_info): Likewise.
	(ipa_edge_modification_sum): Likewise.
	(ipa_edge_modifications): New edge summary.
	(ipa_verify_edge_has_no_modifications): New function.
	(transitive_split_p): Removed.
	(transitive_split_map): Likewise.
	(init_transitive_splits): Likewise.
	(ipa_param_adjustments::modify_call): Adjusted to use the new edge
	summary instead of performed_splits.
	(ipa_param_body_adjustments::register_replacement): Drop dummy
	parameter, set base_index of the created ipa_param_body_replacement.
	(phi_arg_will_live_p): New function.
	(ipa_param_body_adjustments::common_initialization): Do not create
	IPA_SRA dummy decls.
	(simple_tree_swap_info): Removed.
	(remap_split_decl_to_dummy): Likewise.
	(record_argument_state_1): New function.
	(record_argument_state): Likewise.
	(ipa_param_body_adjustments::modify_call_stmt): New parameter
	orig_stmt.  Do not work with dummy decls, save necessary info about
	changes to ipa_edge_modifications.
	(ipa_param_body_adjustments::modify_gimple_stmt): New parameter
	orig_stmt, pass it to modify_call_stmt.
	(ipa_param_body_adjustments::modify_cfun_body): Adjust call to
	modify_gimple_stmt.
	(ipa_edge_modifications_finalize): New function.
	* tree-inline.c (remap_gimple_stmt): Pass original statement to
	modify_gimple_stmt.
	(copy_phis_for_bb): Do not copy dead PHI nodes.
	(expand_call_inline): Do not remap performed_splits.
	(update_clone_info): Likewise.
	* toplev.c: Include ipa-param-manipulation.h.
	(toplev::finalize): Call ipa_edge_modifications_finalize.
2021-06-28 18:24:34 +02:00
Jonathan Wakely
084635aa80 libstdc++: Remove redundant explicit instantiations
These function templates are explicitly specialized for char and wchar_t
streambufs, so the explicit instantiations do nothing. Remove them, to
avoid confusion.

libstdc++-v3/ChangeLog:

	* include/bits/streambuf.tcc (__copy_streambufs_eof): Remove
	explicit instantiation declarations.
	* src/c++11/streambuf-inst.cc (__copy_streambufs_eof): Remove
	explicit instantiation definitions.
2021-06-28 15:16:08 +01:00
Jonathan Wakely
75f948f089 libstdc++: Fix backwards logic in 17_intro/names.cc test [PR 97088]
I meant to undef the names that clash with newlib headers for newlib,
but I only undef'd them for non-newlib targets. This means they still
cause errors for newlib, and aren't tested for other targets.

This fixes the test to check those names for non-newlib targets, and to
undef them to avoid errors for newlib.

libstdc++-v3/ChangeLog:

	PR libstdc++/97088
	* testsuite/17_intro/names.cc: Fix #if condition for names used
	by newlib headers.
2021-06-28 15:15:16 +01:00
Jonathan Wakely
b7a89c041a libstdc++: Allow unique_ptr<Incomplete[]>::operator[] [PR 101236]
PR libstdc++/101236 shows that LLVM depends on being able to use
unique_ptr<T[]>::operator[] when T is incomplete. This is undefined, but
previously worked with libstdc++. When I added the conditional noexcept
to that operator we started to diagnose the incomplete type.

This change restores support for that case, by making the noexcept
condition check that the type is complete before checking whether
indexing on the pointer can throw.  A workaround for PR c++/101239 is
needed to avoid a bogus error where G++ fails to do SFINAE on the
ill-formed p[n] expression and gets an ICE. Instead of checking that the
p[n] expression is valid in the trailing-return-type, we only check that
the element_type is complete.

libstdc++-v3/ChangeLog:

	PR libstdc++/101236
	* include/bits/unique_ptr.h (unique_ptr<T[], D>::operator[]):
	Fail gracefully if element_type is incomplete.
	* testsuite/20_util/unique_ptr/cons/incomplete.cc: Clarify that
	the standard doesn't require this test to work for array types.
	* testsuite/20_util/unique_ptr/lwg2762.cc: Check that incomplete
	types can be used with array specialization.
	* testsuite/20_util/unique_ptr/101236.cc: New test.
2021-06-28 14:20:55 +01:00
Jonathan Wakely
e5c422b7d8 libstdc++: Implement LWG 415 for std::ws
For C++11 std::ws changed to be an unformatted input function, meaning
it constructs a sentry and sets badbit on exceptions.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Document LWG 415 change.
	* doc/html/manual/bugs.html: Regenerate.
	* include/bits/istream.tcc (ws): Create sentry and catch
	exceptions.
	* testsuite/27_io/basic_istream/ws/char/lwg415.cc: New test.
	* testsuite/27_io/basic_istream/ws/wchar_t/lwg415.cc: New test.
2021-06-28 13:34:49 +01:00
Martin Liska
b838641bb0 mklog: Handle correctly long lines.
contrib/ChangeLog:

	* mklog.py: Handle correctly long lines.
	* test_mklog.py: Test it.
2021-06-28 13:43:41 +02:00
Andrew Pinski
9fe9c45ae3 Duplicate the range information of the phi onto the new ssa_name
Since match_simplify_replacement uses gimple_simplify, there is a new
ssa name created sometimes and then we go and replace the phi edge with
this new ssa name, the range information on the phi is lost.
Placing this in replace_phi_edge_with_variable is the best option instead
of doing it in each time replace_phi_edge_with_variable is called which is
what is done today.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Duplicate range
	info if we're the only things setting the target PHI.
	(value_replacement): Don't duplicate range here.
	(minmax_replacement): Likewise.
2021-06-28 03:06:37 -07:00
Richard Biener
f80c4eaca0 tree-optimization/101229 - fix vectorizer SLP hybrid detection with PHIs
This fixes the missing handling of PHIs in gimple_walk_op which causes
the new vectorizer SLP hybrid detection scheme to fail.

2021-06-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101229
	* gimple-walk.c (gimple_walk_op): Handle PHIs.

	* gcc.dg/torture/pr101229.c: New testcase.
2021-06-28 11:55:24 +02:00
Martin Liska
ad26c076aa v850: silent 2 warnings
Silents:

/home/marxin/Programming/gcc/gcc/config/v850/v850.c: In function ‘char* construct_dispose_instruction(rtx)’:
/home/marxin/Programming/gcc/gcc/config/v850/v850.c:2690:22: warning: ‘%s’ directive writing up to 99 bytes into a region of size between 79 and 89 [-Wformat-overflow=]
 2690 |       sprintf (buff, "dispose %d {%s}, r31", stack_bytes / 4, regs);
      |                      ^~~~~~~~~~~~~~~~~~~~~~                   ~~~~
/home/marxin/Programming/gcc/gcc/config/v850/v850.c:2690:15: note: ‘sprintf’ output between 18 and 127 bytes into a destination of size 100
 2690 |       sprintf (buff, "dispose %d {%s}, r31", stack_bytes / 4, regs);
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/marxin/Programming/gcc/gcc/config/v850/v850.c: In function ‘char* construct_prepare_instruction(rtx)’:
/home/marxin/Programming/gcc/gcc/config/v850/v850.c:2814:22: warning: ‘%s’ directive writing up to 99 bytes into a region of size 91 [-Wformat-overflow=]
 2814 |       sprintf (buff, "prepare {%s}, %d", regs, (- stack_bytes) / 4);
      |                      ^~~~~~~~~~~~~~~~~~  ~~~~
/home/marxin/Programming/gcc/gcc/config/v850/v850.c:2814:15: note: ‘sprintf’ output between 14 and 123 bytes into a destination of size 100
 2814 |       sprintf (buff, "prepare {%s}, %d", regs, (- stack_bytes) / 4);
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc/ChangeLog:

	* config/v850/v850.c (construct_dispose_instruction): Allocate
	a bigger buffer.
	(construct_prepare_instruction): Likewise.
2021-06-28 11:28:07 +02:00
Martin Liska
22069036ef v850: add v850_can_inline_p target hook
gcc/ChangeLog:

	* config/v850/v850.c (v850_option_override): Build default
	target node.
	(v850_can_inline_p): New.  Allow MASK_PROLOG_FUNCTION to be
	ignored for inlining.
	(TARGET_CAN_INLINE_P): New.
2021-06-28 11:28:03 +02:00
Richard Biener
2ad71efb5d tree-optimization/101207 - fix BB reduc permute elide with life stmts
This fixes breakage of live lane extracts from permuted loads we elide
from BB reduction vectorization by handling the un-permuting the same
as in the regular eliding code - apply the reverse permute to
both the scalar stmts and the load permutation.

2021-06-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101207
	* tree-vect-slp.c (vect_optimize_slp): Do BB reduction
	permute eliding for load permutations properly.

	* gcc.dg/vect/bb-slp-pr101207.c: New testcase.
2021-06-28 09:42:58 +02:00
Richard Biener
0ad9d88a3d tree-optimization/101173 - fix interchange dependence checking
This adjusts the loop interchange dependence checking to disallow
an outer loop dependence distance of zero.

2021-06-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101173
	* gimple-loop-interchange.cc
	(tree_loop_interchange::valid_data_dependences): Disallow outer
	loop dependence distance of zero.

	* gcc.dg/torture/pr101173.c: New testcase.
2021-06-28 08:33:06 +02:00
liuhongt
3f1a08d9d7 For 128/256-bit vec_cond_expr, When mask operands is lt reg const0_rtx, blendv can be used instead of avx512 mask.
gcc/ChangeLog:

	PR target/100648
	* config/i386/sse.md (*avx_cmp<mode>3_lt): New
	define_insn_and_split.
	(*avx_cmp<mode>3_ltint): Ditto.
	(*avx2_pcmp<mode>3_3): Ditto.
	(*avx2_pcmp<mode>3_4): Ditto.
	(*avx2_pcmp<mode>3_5): Ditto.

gcc/testsuite/ChangeLog:

	PR target/100648
	* g++.target/i386/avx2-pr54700-2.C: Adjust testcase.
	* g++.target/i386/avx512vl-pr54700-1a.C: New test.
	* g++.target/i386/avx512vl-pr54700-1b.C: New test.
	* g++.target/i386/avx512vl-pr54700-2a.C: New test.
	* g++.target/i386/avx512vl-pr54700-2b.C: New test.
	* gcc.target/i386/avx512vl-pr100648.c: New test.
	* gcc.target/i386/avx512vl-blendv-1.c: New test.
	* gcc.target/i386/avx512vl-blendv-2.c: New test.
2021-06-28 09:17:36 +08:00
liuhongt
28560c6d40 Fold blendv builtins into gimple.
Fold __builtin_ia32_pblendvb128 (a, b, c) as VEC_COND_EXPR (c < 0, b,
a), similar for float version but with mask operand VIEW_CONVERT_EXPR
to same sized integer vectype.

gcc/ChangeLog:

	* config/i386/i386-builtin.def (IX86_BUILTIN_BLENDVPD256,
	IX86_BUILTIN_BLENDVPS256, IX86_BUILTIN_PBLENDVB256,
	IX86_BUILTIN_BLENDVPD, IX86_BUILTIN_BLENDVPS,
	IX86_BUILTIN_PBLENDVB128): Replace icode with
	CODE_FOR_nothing.
	* config/i386/i386.c (ix86_gimple_fold_builtin): Fold blendv
	builtins.
	* config/i386/sse.md (*<sse4_1_avx2>_pblendvb_lt_subreg_not):
	New pre_reload splitter.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/funcspec-8.c: Replace
	__builtin_ia32_blendvpd with  __builtin_ia32_roundps_az.
	* gcc.target/i386/blendv-1.c: New test.
	* gcc.target/i386/blendv-2.c: New test.
2021-06-28 09:15:40 +08:00
GCC Administrator
a766c79fc6 Daily bump. 2021-06-28 00:16:30 +00:00
Andrew Pinski
37ad257c06 Fix PR 101230: ICE in fold_cond_expr_with_comparison
This fixes PR 101230 where I had messed up and forgot that
invert_tree_comparison can return ERROR_MARK if the comparsion
is not invertable (floating point types).

Committed as obvious after a bootstrap/test on x86_64-linux-gnu-gnu

gcc/ChangeLog:

	PR middle-end/101230
	* fold-const.c (fold_ternary_loc): Check
	the return value of invert_tree_comparison.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr101230-1.c: New test.
2021-06-27 16:14:29 -07:00
David Edelsohn
3966726333 aix: Add AIX 7.3 configuration and SPDX License Identifiers.
The anticipated release of AIX 7.3 has been announced.  This
	patch adds the configuration bits based on AIX 7.2 configuration.

gcc/ChangeLog:

	* config.gcc: Add SPDX License Identifier.
	(powerpc-ibm-aix789): Default to aix73.h.
	(powerpc-ibm-aix7.2.*.*): New stanza.
	* config/rs6000/aix72.h: Add SPDX License Identifier.
	* config/rs6000/aix73.h: New file.
2021-06-27 16:30:29 -04:00
GCC Administrator
461f937b47 Daily bump. 2021-06-27 00:16:24 +00:00
Patrick Palka
9f26e34a5a c++: access scope during partial spec matching [PR96204]
Here, when determining whether the partial specialization matches
has_type_member<Child>, we do so from the scope of where the template-id
appears rather than from the scope of the specialization, and this
causes us to select the partial specialization (since Child::type is
accessible from Parent).  When we later instantiate this partial
specialization, we've entered the scope of the specialization and so
substitution into e.g. the DECL_CONTEXT of has_type_member::value fails
with access errors since the friend declaration that we relied on to
choose the partial specialization no longer applies.

It seems the appropriate access scope from which to perform partial
specialization matching is the specialization itself (similar to how
we check access of base-clauses), which is what this patch implements.

	PR c++/96204

gcc/cp/ChangeLog:

	* pt.c (instantiate_class_template_1): Enter the scope of the
	type when calling most_specialized_partial_spec.

gcc/testsuite/ChangeLog:

	* g++.dg/template/access40.C: New test.
	* g++.dg/template/access40a.C: New test.
2021-06-26 11:05:54 -04:00