Commit Graph

184338 Commits

Author SHA1 Message Date
GCC Administrator 299859c2a4 Daily bump. 2021-04-08 00:16:44 +00:00
Jason Merrill fb5ed6d8c9 c++: friend with redundant qualification [PR41723]
Different code paths were correctly choosing to look up D directly, since C
is the current instantiation, but here we decided to try to make it a
typename type, leading to confusion.  Fixed by using dependent_scope_p as we
do elsewhere.

gcc/cp/ChangeLog:

	PR c++/41723
	* parser.c (cp_parser_class_name): Check dependent_scope_p.

gcc/testsuite/ChangeLog:

	PR c++/41723
	* g++.dg/template/friend71.C: New test.
2021-04-07 17:01:52 -04:00
Jason Merrill b40d45cb19 c++: base template friend [PR52625]
Here we were mistakenly treating the injected-class-name as a partial
specialization.

gcc/cp/ChangeLog:

	PR c++/52625
	* pt.c (maybe_process_partial_specialization): Check
	DECL_SELF_REFERENCE_P.

gcc/testsuite/ChangeLog:

	PR c++/52625
	* g++.dg/template/friend70.C: New test.
2021-04-07 17:01:36 -04:00
Jason Merrill a528594cf9 c++: using overloaded with local decl [PR92918]
The problem here was that the lookup for 'impl' when parsing the template
only found the using-declaration, not the member function declaration.

This happened because when trying to add the member function declaration,
push_class_level_binding_1 saw that the current binding was a USING_DECL and
the new value is an overload, and decided to just return success.

That 'return true' dates back to r69921.  In
https://gcc.gnu.org/pipermail/gcc-patches/2003-July/110632.html Nathan
mentions that we only push dependent USING_DECLs, which is no longer the
case; now that we retain more USING_DECLs, handling this case like the other
overloaded function cases seems like the obvious solution.

gcc/cp/ChangeLog:

	PR c++/92918
	* name-lookup.c (push_class_level_binding_1): Do overload a new
	function with a previous using-declaration.

gcc/testsuite/ChangeLog:

	PR c++/92918
	* g++.dg/lookup/using66.C: New test.
2021-04-07 15:27:47 -04:00
Richard Sandiford 12029c04d0 testsuite: Fix many UNRESOLVEDs for gcc.dg/vect
It turns out that, on targets that use testglue, many gcc.dg/vect
scan-dump tests became UNRESOLVED after the change to the dump
file naming scheme.

The problem is that, when creating an executable, we normally name
the dump file after both the executable and the source file name.
However, as an exception, we name it after only the source file
name if:

(a) there is only one source file name and
(b) the source file and the executable have the same basename

Both (a) and (b) are normally true when building executables from
gcc.dg/vect.  But (a) is not true when linking against testglue.
The harness was therefore looking for a dump file based only on the
source file name while the compiler was producing a dump file that
contained both names.

We get around this for dg-additional-sources using:

	# This option restores naming of aux and dump output files
	# after input files when multiple input files are named,
	# instead of getting them combined with the output name.
	lappend options "additional_flags=-dumpbase \"\""

This patch does the same thing for executables that are linked
against testglue.  This removes over 2400 UNRESOLVEDs from an
armeb-eabi test run, but in so doing introduces FAILs for some
tests that were previously skipped.

gcc/testsuite/
	* lib/gcc.exp (gcc_target_compile): Add -dumpbase ""
	when building an executable with testglue.
2021-04-07 19:46:37 +01:00
Jonathan Wakely e06d3f5dd7 libstdc++: Fix filesystem::path construction from COW string [PR 99805]
Calling the non-const data() member on a COW string makes it "leaked",
possibly resulting in reallocating the string to ensure a unique owner.

The path::_M_split_cmpts() member parses its _M_pathname string using
string_view objects and then calls _M_pathname.data() to find the offset
of each string_view from the start of the string. However because
_M_pathname is non-const that will cause a COW string to reallocate if
it happens to be shared with another string object. This results in the
offsets calculated for each component being wrong (i.e. undefined)
because the string views no longer refer to substrings of the
_M_pathname member. The fix is to use the parse.offset(c) member which
gets the offset safely.

The bug only happens for the path(string_type&&) constructor and only
for COW strings. When constructed from an lvalue string the string's
contents are copied rather than just incrementing the refcount, so
there's no reallocation when calling the non-const data() member. The
testsuite changes check the lvalue case anyway, because we should
probably change the deep copying to just be a refcount increment (by
adding a path(const string_type&) constructor or an overload for
__effective_range(const string_type&), for COW strings only).

libstdc++-v3/ChangeLog:

	PR libstdc++/99805
	* src/c++17/fs_path.cc (path::_M_split_cmpts): Do not call
	non-const member on _M_pathname, to avoid copy-on-write.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc:
	Check construction from strings that might be shared.
2021-04-07 16:39:24 +01:00
Richard Sandiford 2f3d910461 vect: Restore variable-length SLP permutes [PR97513]
Many of the gcc.target/sve/slp-perm*.c tests started failing
after the introduction of separate SLP permute nodes.
This patch adds variable-length support using a similar
technique to vect_transform_slp_perm_load.

As there, the idea is to detect when every permute mask vector
is the same and can be generated using a regular stepped sequence.
We can easily handle those cases for variable-length, but still
need to restrict the general case to constant-length.

Again copying vect_transform_slp_perm_load, the idea is to distinguish
the two cases regardless of whether the length is variable or not,
partly to increase testing coverage and partly because it avoids
generating redundant trees.

Doing this means that we can also use SLP for the two-vector
permute in pr88834.c, which we couldn't before VEC_PERM_EXPR
nodes were introduced.  The patch therefore makes pr88834.c
check that we don't regress back to not using SLP and adds
pr88834_ld3.c to check for the original problem in the PR.

gcc/
	PR tree-optimization/97513
	* tree-vect-slp.c (vect_add_slp_permutation): New function,
	split out from...
	(vectorizable_slp_permutation): ...here.  Detect cases in which
	all VEC_PERM_EXPRs are guaranteed to have the same stepped
	permute vector and only generate one permute vector for that case.
	Extend that case to handle variable-length vectors.

gcc/testsuite/
	* gcc.target/aarch64/sve/pr88834.c: Expect the vectorizer to use SLP.
	* gcc.target/aarch64/sve/pr88834_ld3.c: New test.
2021-04-07 15:21:56 +01:00
Richard Sandiford 5c5b31975e vect: Don't split store groups if we have IFN_STORE_LANES [PR99873]
As noted in the PR, we were no longer using ST3 for the testcase and
instead stored each lane individually.  This is because we'd split
the store group during SLP and couldn't recover when SLP failed.

However, we can also get better code with ST3 and ST4 even if SLP would
have succeeded, such as for vect-complex-5.c.  I'm not sure exactly
where the cut-off point is, but it seems reasonable to allow the split
if either of the new groups would operate on full vectors *within*
rather than across scalar loop iterations.

E.g. on a Cortex-A57, pr99873_3.c performs better using ST4 while
pr99873_2.c performs better with SLP.

Another factor is that SLP can handle smaller iteration counts than
IFN_STORE_LANES can, but we don't have the infrastructure to choose
reliably based on that.

gcc/
	PR tree-optimization/99873
	* tree-vect-slp.c (vect_slp_prefer_store_lanes_p): New function.
	(vect_build_slp_instance): Don't split store groups that could
	use IFN_STORE_LANES.

gcc/testsuite/
	* gcc.dg/vect/slp-21.c: Only expect 2 of the loops to use SLP
	if IFN_STORE_LANES is available.
	* gcc.dg/vect/vect-complex-5.c: Expect no loops to use SLP if
	IFN_STORE_LANES is available.
	* gcc.target/aarch64/pr99873_1.c: New test.
	* gcc.target/aarch64/pr99873_2.c: Likewise.
	* gcc.target/aarch64/pr99873_3.c: Likewise.
	* gcc.target/aarch64/sve/pr99873_1.c: Likewise.
	* gcc.target/aarch64/sve/pr99873_2.c: Likewise.
	* gcc.target/aarch64/sve/pr99873_3.c: Likewise.
2021-04-07 15:21:55 +01:00
Jakub Jelinek b51321bc51 varasm: Fix up constpool alias handling [PR99872]
Last year, I have added in r11-2944-g0106300f6c3f7bae5eb1c46dbd45aa07c94e1b15
(aka PR54201 fix) code to find bitwise duplicates in constant pool and output
them as aliases instead of duplicating the data.

Unfortunately this broke mingw32 -m32.
On most targets, ASM_GENERATE_INTERNAL_LABEL with "LC" emits something like
*.LC123 and the targets don't add user label prefixes, so the aliases
that we print should be something like
        .set    .LC5, .LC6
or
        .set    .LC5, .LC6 + 8
and I wasn't sure if ASM_OUTPUT_DEF can handle the * and therefore I have
stripped it.
But, on mingw32 -m32, ASM_GENERATE_INTERNAL_LABEL with "LC" emits
*LC123 and the target has user label prefixes, which means what I wrote
results in
LC6:
        ...
        .set    _LC5, _LC6
which results in unresolved symbols.  I went through the ASM_OUTPUT_DEF
definitions of all targets and all of them use assemble_name twice under
the hood (with various differences on what they print before, in between or
after those names).  And assemble_name handles the name encoding properly,
so if we pass it ASM_OUTPUT_DEF (..., "*.LC123", "*.LC456+16") it will
emit .LC123 and .LC456+16 and if we pass it "*LC789", it will emit
LC789.

2021-04-07  Jakub Jelinek  <jakub@redhat.com>

	PR target/99872
	* varasm.c (output_constant_pool_contents): Don't strip name encoding
	from XSTR (desc->sym, 0) or from label before passing those to
	ASM_OUTPUT_DEF.
2021-04-07 15:51:15 +02:00
Richard Biener c01ae2ab6b tree-optimization/99954 - fix loop distribution memcpy classification
This fixes bogus classification of a copy as memcpy.  We cannot use
plain dependence analysis to decide between memcpy and memmove when
it computes no dependence.  Instead we have to try harder later which
the patch does for the gcc.dg/tree-ssa/ldist-24.c testcase by resorting
to tree-affine to compute the difference between src and dest and
compare against the copy size.

2021-04-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99954
	* tree-loop-distribution.c: Include tree-affine.h.
	(generate_memcpy_builtin): Try using tree-affine to prove
	non-overlap.
	(loop_distribution::classify_builtin_ldst): Always classify
	as PKIND_MEMMOVE.

	* gcc.dg/torture/pr99954.c: New testcase.
2021-04-07 13:25:06 +02:00
Richard Biener 0d6ad10c17 testsuite/99955 - fix may_alias declaration of vector
This fixes the order of the type attributes to preserve may_alias
for the vector type.

2021-04-07  Richard Biener  <rguenther@suse.de>

	PR testsuite/99955
	* gcc.c-torture/execute/pr92618.c: Move may_alias attributes
	last.
2021-04-07 13:22:58 +02:00
Richard Biener d11bcbe166 tree-optimization/99947 - avoid v.safe_push (v[0])
This avoids (again) the C++ pitfall of pushing a reference to
sth being reallocated.

2021-04-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99947
	* tree-vect-loop.c (vectorizable_induction): Pre-allocate
	steps vector to avoid pushing elements from the reallocated
	vector.

	* gcc.dg/torture/pr99947.c: New testcase.
2021-04-07 10:04:20 +02:00
Richard Biener 6eaf7ac6f4 Add debug_vn_reference_ops helper
This factors out a helper to dump VN reference operands, sth that
proves useful in debugging VN issues.

2021-04-07  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.h (print_vn_reference_ops): Declare.
	* tree-ssa-pre.c (print_pre_expr): Factor out VN reference operand
	printing...
	* tree-ssa-sccvn.c (print_vn_reference_ops): ... into this new
	function.
	(debug_vn_reference_ops): New.
2021-04-07 09:59:07 +02:00
Bin Cheng e0bdccac58 tree-optimization/98736 - use programing order preserved RPO in ldist
Tree loop distribution uses RPO to build reduced dependence graph,
it's important that RPO preserves the original programing order.
Though it usually does so, when distributing loop nest, exit BB can
be placed before some loop BBs while after loop header.  This patch
fixes the issue by calling rev_post_order_and_mark_dfs_back_seme.

gcc/ChangeLog:

	PR tree-optimization/98736
	* tree-loop-distribution.c
	* (loop_distribution::bb_top_order_init):
	Compute RPO with programing order preserved by calling function
	rev_post_order_and_mark_dfs_back_seme.

gcc/testsuite/ChangeLog:

	PR tree-optimization/98736
	* gcc.c-torture/execute/pr98736.c: New test.
2021-04-07 10:24:32 +08:00
Marek Polacek a7698c0e1e c++: Add test for Core issue 1376 [PR52202]
As Jens says in the PR, we handle this correctly.

gcc/testsuite/ChangeLog:

	PR c++/52202
	* g++.dg/cpp0x/rv-life.C: New test.
2021-04-06 22:18:17 -04:00
GCC Administrator 8cac6af6f8 Daily bump. 2021-04-07 00:16:39 +00:00
Joseph Myers b29ddf93a4 Update gcc de.po.
* de.po: Update.
2021-04-06 22:41:14 +00:00
Joseph Myers 2a77cc1710 Update gcc sv.po.
* sv.po: Update.
2021-04-06 22:32:29 +00:00
Jason Merrill de03b82f3c c++: access checking in aggregate initialization [PR96673]
We were deferring access checks while parsing B<int>{}, didn't adjust that
when we went to instantiate the default member initializer for B::c,
deferred access checking for C::C, and then checked it after parsing
B<int>{}, back in the main() context which has no access.  We need to do the
access checks in the class context of the DMI.

I tried fixing this in push_to/pop_from_top_level, but that caused several
regressions.

gcc/cp/ChangeLog:

	PR c++/96673
	* init.c (get_nsdmi): Don't defer access checking.

gcc/testsuite/ChangeLog:

	PR c++/96673
	* g++.dg/cpp1y/nsdmi-aggr13.C: New test.
2021-04-06 16:08:40 -04:00
Jason Merrill 8685348075 c++: C++17 constexpr static data member linkage [PR99901]
C++17 makes constexpr static data members implicitly inline variables.  In
C++14, a subsequent out-of-class declaration is the definition.  We want to
continue emitting a symbol for such a declaration in C++17 mode, for ABI
compatibility with C++14 code that wants to refer to it.

Normally I'd distinguish in- and out-of-class declarations by looking at
DECL_IN_AGGR_P, but we never set DECL_IN_AGGR_P on inline variables.  I
think that's wrong, but don't want to mess with it so close to release.
Conveniently, we already have a test for in-class declaration earlier in the
function.

gcc/cp/ChangeLog:

	PR c++/99901
	* decl.c (cp_finish_decl): mark_needed an implicitly inline
	static data member with an out-of-class redeclaration.

gcc/testsuite/ChangeLog:

	PR c++/99901
	* g++.dg/cpp1z/inline-var9.C: New test.
2021-04-06 14:30:02 -04:00
Iain Buclaw d48f87d5c1 d: Fix missing call to va_end in getMatchError [PR99917]
Reviewed-on: https://github.com/dlang/dmd/pull/12380

gcc/d/ChangeLog:

	PR d/99917
	* dmd/MERGE: Merge upstream dmd d16195406.
2021-04-06 19:43:31 +02:00
Iain Buclaw 62321ab477 d: Use Array::find to get index of element
gcc/d/ChangeLog:

	* d-codegen.cc (build_frame_type): Use Array::find to get index of
	element.
2021-04-06 19:43:31 +02:00
Iain Buclaw 4993d0265e d: Increment gaggedWarnings if warning or deprecation message was suppressed
gcc/d/ChangeLog:

	* d-diagnostic.cc (vwarning): Increment gaggedWarnings if warning
	message	was suppressed.
	(vdeprecation): Likewise for deprecation messages.
2021-04-06 19:43:31 +02:00
Iain Buclaw dddf3bb0c3 d: Merge upstream dmd 5cc71ff83, druntime 1134b710
D front-end changes:

 - Fix ICEs that occurred when using opaque enums.

 - Update `pragma(printf)' checking code to work on 16-bit targets.

Phobos change:

 - Don't compile in argTypes code on AArch64

Reviewed-on: https://github.com/dlang/dmd/pull/12378
	     https://github.com/dlang/druntime/pull/3431

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 5cc71ff83.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 1134b710.
2021-04-06 19:43:30 +02:00
Jonathan Wakely 406f58e1e3 libstdc++: Add nodiscard attribute to cast-like functions
Add [[nodiscard]] to functions that are effectively just a static_cast,
as per P2351. Also add it to std::addressof.

libstdc++-v3/ChangeLog:

	* include/bits/move.h (forward, move, move_if_noexcept)
	(addressof): Add _GLIBCXX_NODISCARD.
	* include/bits/ranges_cmp.h (identity::operator()): Add
	nodiscard attribute.
	* include/c_global/cstddef (to_integer): Likewise.
	* include/std/bit (bit_cast): Likewise.
	* include/std/utility (as_const, to_underlying): Likewise.
2021-04-06 16:43:25 +01:00
Jonathan Wakely 41019bfae2 libstdc++: Clarify static_assert message
libstdc++-v3/ChangeLog:

	* include/bits/move.h (forward): Change static_assert message
	to be unambiguous about what must be true.
	* testsuite/20_util/forward/c_neg.cc: Adjust dg-error.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
2021-04-06 16:43:24 +01:00
Jonathan Wakely daef4e4d93 libstdc++: Fix Doxygen warnings
libstdc++-v3/ChangeLog:

	* include/bits/alloc_traits.h: Use markdown for code font.
	* include/bits/basic_string.h: Fix @param names.
	* include/bits/max_size_type.h: Remove period after @file.
	* include/bits/regex.h: Fix duplicate @retval names, and rename.
	* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add
	group open to match existing group close.
	* include/ext/pb_ds/priority_queue.hpp: Add blank line before group
	open.
2021-04-06 16:43:24 +01:00
Jonathan Wakely f0b883464c libstdc++: Fix doxygen markup for group close commands
A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by
Doxygen, so doesn't close a @{ group. A "///" comment needs to be used.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h: Fix doxygen group close.
	* include/bits/basic_ios.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/fs_dir.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/bits/functional_hash.h: Likewise.
	* include/bits/gslice.h: Likewise.
	* include/bits/gslice_array.h: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/indirect_array.h: Likewise.
	* include/bits/locale_classes.h: Likewise.
	* include/bits/locale_facets.h: Likewise.
	* include/bits/locale_facets_nonio.h: Likewise.
	* include/bits/mask_array.h: Likewise.
	* include/bits/refwrap.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/regex_automaton.h: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/bits/regex_executor.h: Likewise.
	* include/bits/regex_scanner.h: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_atomic.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/slice_array.h: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/std_function.h: Likewise.
	* include/bits/std_mutex.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_numeric.h: Likewise.
	* include/bits/stl_pair.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/stream_iterator.h: Likewise.
	* include/bits/streambuf_iterator.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/decimal/decimal: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/fs_dir.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/buffer: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/socket: Likewise.
	* include/ext/pb_ds/assoc_container.hpp: Likewise.
	* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp:
	Likewise.
	* include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise.
	* include/ext/pb_ds/detail/types_traits.hpp: Likewise.
	* include/ext/pb_ds/exception.hpp: Likewise.
	* include/ext/pb_ds/priority_queue.hpp: Likewise.
	* include/ext/pb_ds/tag_and_trait.hpp: Likewise.
	* include/ext/random: Likewise.
	* include/std/any: Likewise.
	* include/std/atomic: Likewise.
	* include/std/bitset: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/fstream: Likewise.
	* include/std/future: Likewise.
	* include/std/iostream: Likewise.
	* include/std/istream: Likewise.
	* include/std/mutex: Likewise.
	* include/std/numeric: Likewise.
	* include/std/ostream: Likewise.
	* include/std/ratio: Likewise.
	* include/std/shared_mutex: Likewise.
	* include/std/stdexcept: Likewise.
	* include/std/streambuf: Likewise.
	* include/std/system_error: Likewise.
	* include/std/thread: Likewise.
	* include/std/valarray: Likewise.
	* include/std/variant: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* libsupc++/atomic_lockfree_defines.h: Likewise.
	* libsupc++/exception: Likewise.
	* libsupc++/exception.h: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/nested_exception.h: Likewise.

libstdc++-v3/ChangeLog:

	* include/tr1/regex:
2021-04-06 16:43:24 +01:00
Vladimir N. Makarov 4bbd51afaa [PR99781] Update correctly reg notes in LRA for multi-registers and set up biggest mode safely
The PR is about incorrect use of partial_subreg_p for unordered modes.
I found 2 places of dangerous comparing unordered modes in LRA.  The
patch removes dangerous use of paradoxical_subreg_p and
partial_subreg_p in split_reg and process_bb_lives.  The both places
used them to solve PR77761 long time ago.  But the problem was also
fixed by later patches too (if there is no hard reg explicitly, it
have VOIDmode and we use natural mode to split hard reg live,
otherwise we use the biggest explicitly used mode for hard reg
splitting).  The PR also says about inaccurate update of reg notes in
LRA.  It happens for reg notes which refer for multi-registers.  The
patch also fixes this issue.

gcc/ChangeLog:

	PR target/99781
	* lra-constraints.c (split_reg): Don't check paradoxical_subreg_p.
	* lra-lives.c (clear_sparseset_regnos, regnos_in_sparseset_p): New
	functions.
	(process_bb_lives): Don't update biggest mode of hard reg for
	implicit in multi-register group.  Use the new functions for
	updating dead_set and unused_set by register notes.

gcc/testsuite/ChangeLog:

	PR target/99781
	* g++.target/aarch64/sve/pr99781.C: New.
2021-04-06 09:22:16 -04:00
Xianmiao Qu 498d2ba584 C-SKY: Describe ck802 bypass accurately.
Fix the following warning:
insn-automata.c: In function ‘int maximal_insn_latency(rtx_insn*)’:
insn-automata.c:679:37: warning: array subscript -1 is below array bounds of ‘const unsigned char [19]’ [-Warray-bounds]
  679 |   return default_latencies[insn_code];
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
insn-automata.c:397:30: note: while referencing ‘default_latencies’
  397 |   static const unsigned char default_latencies[] =
      |

gcc/
	* config/csky/csky_pipeline_ck802.md : Use insn reservation name
	instead of *.
2021-04-06 20:48:32 +08:00
H.J. Lu a32452a544 x86: Update memcpy/memset inline strategies for Skylake family CPUs
Simply memcpy and memset inline strategies to avoid branches for
Skylake family CPUs:

1. With MOVE_RATIO and CLEAR_RATIO == 17, GCC will use integer/vector
   load and store for up to 16 * 16 (256) bytes when the data size is
   fixed and known.
2. Inline only if data size is known to be <= 256.
   a. Use "rep movsb/stosb" with simple code sequence if the data size
      is a constant.
   b. Use loop if data size is not a constant.
3. Use memcpy/memset libray function if data size is unknown or > 256.

On Cascadelake processor with -march=native -Ofast -flto,

1. Performance impacts of SPEC CPU 2017 rate are:

500.perlbench_r  0.17%
502.gcc_r       -0.36%
505.mcf_r        0.00%
520.omnetpp_r    0.08%
523.xalancbmk_r -0.62%
525.x264_r       1.04%
531.deepsjeng_r  0.11%
541.leela_r     -1.09%
548.exchange2_r -0.25%
557.xz_r         0.17%
Geomean         -0.08%

503.bwaves_r     0.00%
507.cactuBSSN_r  0.69%
508.namd_r      -0.07%
510.parest_r     1.12%
511.povray_r     1.82%
519.lbm_r        0.00%
521.wrf_r       -1.32%
526.blender_r   -0.47%
527.cam4_r       0.23%
538.imagick_r   -1.72%
544.nab_r       -0.56%
549.fotonik3d_r  0.12%
554.roms_r       0.43%
Geomean          0.02%

2. Significant impacts on eembc benchmarks are:

eembc/idctrn01   9.23%
eembc/nnet_test  29.26%

gcc/

	* config/i386/x86-tune-costs.h (skylake_memcpy): Updated.
	(skylake_memset): Likewise.
	(skylake_cost): Change CLEAR_RATIO to 17.
	* config/i386/x86-tune.def (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB):
	Replace m_CANNONLAKE, m_ICELAKE_CLIENT, m_ICELAKE_SERVER,
	m_TIGERLAKE and m_SAPPHIRERAPIDS with m_SKYLAKE and m_CORE_AVX512.

gcc/testsuite/

	* gcc.target/i386/memcpy-strategy-9.c: New test.
	* gcc.target/i386/memcpy-strategy-10.c: Likewise.
	* gcc.target/i386/memcpy-strategy-11.c: Likewise.
	* gcc.target/i386/memset-strategy-7.c: Likewise.
	* gcc.target/i386/memset-strategy-8.c: Likewise.
	* gcc.target/i386/memset-strategy-9.c: Likewise.
2021-04-06 05:36:00 -07:00
Richard Biener e5c170e080 tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs
This adds a relevancy check before trying to set the vector def of
a backedge in an unvectorized PHI.

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

	PR tree-optimization/99880
	* tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only
	set vectorized defs of relevant PHIs.

	* gcc.dg/torture/pr99880.c: New testcase.
2021-04-06 14:20:28 +02:00
Nathan Sidwell 671f9f5c0f c++: Simplify va_arg test
The va_arg scans are just too brittle.  Let's not be that picky.  We
have other tested builtins that are less brittle now anyway.

	gcc/testsuite/
	* g++.dg/modules/builtin-3_a.C: Remove dump scans.
	* g++.dg/modules/builtin-3_b.C: Remove dump scans.
2021-04-06 05:07:17 -07:00
Nathan Sidwell 86532e5419 libcody: Remove FSF license
Apparently this was never needed.

	libcody/
	* LICENSE.gcc: Delete.
2021-04-06 05:07:17 -07:00
Jakub Jelinek bfeb36bd03 testsuite: Fix up pr96573.c on aarch64 [PR96573]
On Thu, Apr 01, 2021 at 02:16:55PM +0100, Alex Coplan via Gcc-patches wrote:
> FYI, I'm seeing the new test failing on aarch64:
>
> PASS: gcc.dg/pr96573.c (test for excess errors)
> FAIL: gcc.dg/pr96573.c scan-tree-dump optimized "__builtin_bswap"

The vectorizer in the aarch64 case manages to emit a VEC_PERM_EXPR instead
(which is just as efficient).

So, do we want to go for the following (and/or perhaps also restrict the test to
a couple of targets where it works?  In my last distro build it failed only
on aarch64-linux, while armv7hl-linux-gnueabi and
{i686,x86_64,powerpc64le,s390x}-linux were fine)?

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

	PR tree-optimization/96573
	* gcc.dg/pr96573.c: Instead of __builtin_bswap accept also
	VEC_PERM_EXPR with bswapping permutation.
2021-04-06 12:46:22 +02:00
Richard Biener 58cd9fc8a6 tree-optimization/99924 - visit permute nodes again when partitioning
Since SLP graph partitioning works on scalar stmts (because it's done
for costing) we have to make sure to visit permute nodes multiple
times since they will not pull partitions together.

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

	PR tree-optimization/99924
	* tree-vect-slp.c (vect_bb_partition_graph_r): Do not mark
	nodes w/o scalar stmts as visited.

	* gfortran.dg/vect/pr99924.f90: New testcase.
2021-04-06 12:15:30 +02:00
Jakub Jelinek ffc2331d79 testsuite: Fix up g++.dg/ext/vector40.C test
The test FAILs on i686-linux due to -Wpsabi diagnostics.

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

	PR c++/97900
	* g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options.
2021-04-06 11:46:32 +02:00
Alex Coplan 16ea7f5789 arm: Fix PCS for SFmode -> SImode libcalls [PR99748]
This patch fixes PR99748 which shows us trying to pass the argument to
__aeabi_f2iz in the VFP register s0 when the library function is
expecting to use the GPR r0. It also fixes the __aeabi_f2uiz case which
was broken in the same way.

For the testcase in the PR, here is the code we generate before the
patch (with -mfloat-abi=hard -march=armv8.1-m.main+mve -O0):

main:
    push    {r7, lr}
    sub     sp, sp, #8
    add     r7, sp, #0
    mov     r3, #1065353216
    str     r3, [r7, #4]    @ float
    vldr.32 s0, [r7, #4]
    bl      __aeabi_f2iz
    mov     r3, r0
    cmp     r3, #1
    [...]

This becomes:

main:
    push    {r7, lr}
    sub     sp, sp, #8
    add     r7, sp, #0
    mov     r3, #1065353216
    str     r3, [r7, #4]    @ float
    ldr     r0, [r7, #4]    @ float
    bl      __aeabi_f2iz
    mov     r3, r0
    cmp     r3, #1
    [...]

after the patch. We see a similar change for the same testcase with a
cast to unsigned instead of int.

gcc/ChangeLog:

	PR target/99748
	* config/arm/arm.c (arm_libcall_uses_aapcs_base): Also use base
	PCS for [su]fix_optab.
2021-04-06 09:06:27 +01:00
Jason Merrill 55f40d968b c++: mangling of lambdas in default args [PR91241]
In this testcase, the parms remembered in LAMBDA_EXPR_EXTRA_SCOPE are no
longer the parms of the FUNCTION_DECL they have as their DECL_CONTEXT, so we
were mangling both lambdas as parm #0.  But since the parms are numbered
from right to left we don't need to need to find them in the FUNCTION_DECL,
we can measure their own DECL_CHAIN.

gcc/cp/ChangeLog:

	PR c++/91241
	* mangle.c (write_compact_number): Add sanity check.
	(write_local_name): Use list_length for parm number.

gcc/testsuite/ChangeLog:

	PR c++/91241
	* g++.dg/abi/lambda-defarg1.C: New test.
2021-04-06 00:12:57 -04:00
Patrick Palka 66de517b1c c++: placeholder type constraint in structured binding [PR99899]
In this PR, we're crashing because the constraint handling inside
do_auto_deduction doesn't expect to see an adc_decomp_type context.
This patch fixes this by treating adc_decomp_type like adc_variable_type
or adc_return_type during placeholder type constraint checking.

Meanwhile, I noticed we weren't checking constraints at all when binding
an array via a structured binding, since do_auto_deduction would exit
early and bypass the constraint check.  This patch fixes this by
replacing the early exit with an appropriate setup of the 'targs'
vector.

gcc/cp/ChangeLog:

	PR c++/99899
	* pt.c (do_auto_deduction): Don't exit early when deducing the
	array type of a structured binding.  Also handle adc_decomp_type
	during constraint checking.

gcc/testsuite/ChangeLog:

	PR c++/99899
	* g++.dg/cpp2a/concepts-placeholder7.C: New test.
	* g++.dg/cpp2a/concepts-placeholder8.C: New test.
2021-04-05 23:35:56 -04:00
GCC Administrator b1da991623 Daily bump. 2021-04-06 00:16:43 +00:00
Jason Merrill b07dd9b0d0 c++: -Wunused, constant, and generic lambda [PR96311]
We never called mark_use for a return value in a function with dependent
return type.  In that situation we don't know if the use is as an rvalue or
lvalue, but we can use mark_exp_read instead.

gcc/cp/ChangeLog:

	PR c++/96311
	* typeck.c (check_return_expr): Call mark_exp_read in dependent
	case.

gcc/testsuite/ChangeLog:

	PR c++/96311
	* g++.dg/cpp1y/lambda-generic-Wunused.C: New test.
2021-04-05 17:27:24 -04:00
Jason Merrill 07f56824fd c++: reinterpret_cast from prvalue to rvalue ref [PR98440]
In r260622 I allowed this under the general principle that [basic.lval]
"Whenever a prvalue appears as an operand of an operator that expects a
glvalue for that operand, the temporary materialization conversion (7.3.4)
is applied to convert the expression to an xvalue."  But
[expr.reinterpret.cast] specifically excludes creating a temporary in this
case.

gcc/cp/ChangeLog:

	PR c++/98440
	* typeck.c (build_reinterpret_cast_1): Don't perform
	temporary materialization.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error.
	* g++.dg/cpp0x/reinterpret_cast2.C: Adjust message.
	* g++.old-deja/g++.jason/rvalue3.C: Likewise.
2021-04-05 17:27:00 -04:00
Jason Merrill 9f4c41147a c++: enum in generic lambda in template [PR95317]
Here we weren't instantiating the enumerators because the arglist still had
the template parameter for the generic lambda, so looking one up failed.  We
need to instantiate if the non-lambda enclosing scope is non-dependent.

gcc/cp/ChangeLog:

	PR c++/95317
	* pt.c (lookup_template_class_1): Do tsubst_enum when
	tsubsting a generic lambda.

gcc/testsuite/ChangeLog:

	PR c++/95317
	* g++.dg/cpp1y/lambda-generic-enum1.C: New test.
2021-04-05 15:38:40 -04:00
Jason Merrill 62d60246e5 c++: lambda in DMI in class template [PR95870]
Here enclosing_instantiation_of was failing to find a match because otctx is
struct S<T> and current_function_decl is S<int>::S(), so the latter has more
function contexts, and we end up trying to compare S() to NULL_TREE.

After spending a bit of time working on establishing the correspondence in
this case (class <=> constructor), it occurred to me that we could just use
DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
redeclared.  Since we're so close to release, for now I'm only doing this
for the case that was failing before.

gcc/cp/ChangeLog:

	PR c++/95870
	* pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION if
	there is no enclosing non-lambda function.

gcc/testsuite/ChangeLog:

	PR c++/95870
	* g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.
2021-04-05 15:37:01 -04:00
Eric Botcazou 7ebdef2076 Fix small regression with -fdump-ada-spec
When the enumeration constants of an enumeration type are defined by
explicit values, the binding generated by -fdump-ada-spec does not use
an enumeration type on the Ada side, because the set of allowed values
in C/C++ is larger than the set of allowed values in Ada, but instead
use an integer subtype and defines a set of explicit constants, which
used to be of this subtype but were changed to the base type at some
point.  This reinstates the subtype for them.

gcc/c-family/
	* c-ada-spec.c (is_simple_enum): Minor tweaks.
	(dump_ada_enum_type): Add TYPE and PARENT parameters.  For non-simple
	enumeral types use again the type name for the enumeration constants.
	(dump_ada_node): Adjust call to dump_ada_enum_type.
	(dump_nested_type): Likewise.
2021-04-05 19:52:29 +02:00
Michael Meissner f1d012911b Honor --disable-decimal-float on PowerPC Decimal/Float128 conversions
This patch fixes the problem that the Decimal <-> Float128 conversions
were built even if the user configured GCC with --disable-decimal-float.

libgcc/
2021-04-05  Florian Weimer  <fweimer@redhat.com>

	* config/rs6000/t-float128 (fp128_ppc_funcs): Add decimal floating
	point functions for $(decimal_float) only.

Co-Authored-By: Michael Meissner  <meissner@linux.ibm.com>
2021-04-05 13:33:16 -04:00
Nathan Sidwell dd6f588a7b c++: Unneeded export query [PR 99380]
This problem got introduced fixing a module numbering problem.  When
preprocessing a header unit, we don't need to send an EXPORT query
unless we're also determining dependencies, or the mapper asked us
to.  Sadly the testsuite isn't set up to test this kind of subtlety.
I manually did that with stdin/stdout.

	PR c++/99380
	gcc/cp/
	* module.cc (name_pending_imports): Drop 'atend' parm.  Don't
	query export when not needed.
	(preprocess_module, preprocessed_module): Adjust.
2021-04-05 07:55:41 -07:00
David Malcolm 7d8f4240c9 analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906]
gcc/analyzer/ChangeLog:
	PR analyzer/99906
	* analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL
	dereference on calls with zero arguments.
	* sm-malloc.cc (malloc_state_machine::on_stmt): When handling
	__attribute__((nonnull)), only call get_diagnostic_tree if the
	result will be used.

gcc/testsuite/ChangeLog:
	PR analyzer/99906
	* gcc.dg/analyzer/pr99906.c: New test.
2021-04-05 10:51:46 -04:00
David Malcolm 69b66ff023 analyzer: fix apparent hang with -fanalyzer-verbosity=0 [PR analyzer/99886]
The analyzer appeared to enter an infinite loop on malloc-1.c
when -fanalyzer-verbosity=0 was used.  In fact, it was slowly
counting from 0 to 0xffffffff.

Root cause is looping up to effectively ((unsigned)0) - 1 in
diagnostic_manager::consolidate_conditions when there are no events
in the path.

Fixed by the following, which uses signed integers when subtracting
from path->num_events () when simplifying checker_paths.

gcc/analyzer/ChangeLog:
	PR analyzer/99886
	* diagnostic-manager.cc
	(diagnostic_manager::prune_interproc_events): Use signed integers
	when subtracting one from path->num_events ().
	(diagnostic_manager::consolidate_conditions): Likewise.  Convert
	next_idx to a signed int.

gcc/testsuite/ChangeLog:
	PR analyzer/99886
	* gcc.dg/analyzer/pr99886.c: New test.
2021-04-05 10:48:01 -04:00