Jonathan Wakely [Fri, 31 Mar 2023 12:44:04 +0000 (13:44 +0100)]
libstdc++: Teach optimizer that empty COW strings are empty [PR107087]
The compiler doesn't know about the invariant that the _S_empty_rep()
object is immutable and so _M_length and _M_refcount are always zero.
This means that we get warnings about writing possibly-non-zero length
strings into buffers that can't hold them. If we teach the compiler that
the empty rep is always zero length, it knows it can be copied into any
buffer.
For Stage 1 we might want to also consider adding this to capacity():
if (_S_empty_rep()._M_capacity != 0)
__builtin_unreachable();
And this to _Rep::_M_is_leaked() and _Rep::_M_is_shared():
if (_S_empty_rep()._M_refcount != 0)
__builtin_unreachable();
libstdc++-v3/ChangeLog:
PR tree-optimization/107087
* include/bits/cow_string.h (basic_string::size()): Add
optimizer hint that _S_empty_rep()._M_length is always zero.
(basic_string::length()): Call size().
Jakub Jelinek [Fri, 31 Mar 2023 20:48:44 +0000 (22:48 +0200)]
testsuite, analyzer: Fix up pipe-glibc.c testcase [PR107396]
The gcc.dg/analyzer/pipe-glibc.c test FAILs when using recent glibc headers
and succeeds with older headers.
The important change is that
https://sourceware.org/git/?p=glibc.git;a=commit;h=
c1760eaf3b575ad174fd88b252fd16bd525fa818
in 2021 added __attribute__ ((__malloc__ (fclose, 1))) attribute to fdopen,
so in write_to_pipe there is an excess warning:
.../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c: In function 'write_to_pipe':
.../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: warning: use of possibly-NULL 'stream' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
.../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:27:12: note: (1) this call could return NULL
.../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: note: (2) argument 4 ('stream') from (1) could be NULL where non-null expected
<built-in>: note: argument 4 of '__builtin_fwrite' must be non-null
Strangely, nothing is reported on the read_from_pipe function, seems
fwrite/fprintf/fputc etc. are builtins in GCC and we mark the FILE *
arguments as nonnull there on the builtin declarations, while fgetc/fread
etc. aren't builtins and glibc doesn't mark any of those using nonnull.
Shall we change that on the glibc side?
Anyway, because this differs based on glibc version and I think the
above warning is not the primary intention of the test, I think it is
best to tweak it so that this warning isn't reported.
Another option would be avoid using glibc headers and use our own
declarations, or make sure we add the malloc with fclose attribute ourselves
(but fdopen in the libc headers could be a macro, so not sure
__typeof (fdopen) fdopen __attribute__ ((__malloc__, __malloc__ (fclose, 1)));
would work). Or use -Wno-analyzer-possible-null-arguments in
dg-additional-options?
2023-03-31 Jakub Jelinek <jakub@redhat.com>
PR analyzer/107396
* gcc.dg/analyzer/pipe-glibc.c (read_from_pie, write_to_pipe): Exit
if fdopen returns NULL.
Andrew MacLeod [Fri, 31 Mar 2023 19:42:43 +0000 (15:42 -0400)]
Adjust testcases to not produce errors..
tree-optimization/109363
gcc/testsuite/
* g++.dg/warn/Wstringop-overflow-4.C: Always check bogus message.
* gcc.dg/tree-ssa/pr23109.c: Disable better recomputations.
Vladimir N. Makarov [Fri, 31 Mar 2023 15:04:44 +0000 (11:04 -0400)]
LRA: Implement commutative operands exchange for combining secondary memory reload and original insn
The patch implements trying commutative operands exchange for
combining secondary memory reload and original insn.
PR rtl-optimization/109052
gcc/ChangeLog:
* lra-constraints.cc: (combine_reload_insn): New function.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr109052-2.c: New.
Jonathan Wakely [Fri, 31 Mar 2023 12:38:14 +0000 (13:38 +0100)]
libstdc++: Avoid -Wmaybe-uninitialized warning in std::stop_source [PR109339]
We pass a const-reference to *this before it's constructed, and GCC
assumes that all const-references are accessed. Add the access attribute
to say it's not accessed.
libstdc++-v3/ChangeLog:
PR libstdc++/109339
* include/std/stop_token (_Stop_state_ptr(const stop_source&)):
Add attribute access with access-mode 'none'.
* testsuite/30_threads/stop_token/stop_source/109339.cc: New test.
Jonathan Wakely [Fri, 31 Mar 2023 12:17:00 +0000 (13:17 +0100)]
libstdc++: Revert addition of boolean flag to net::ip::basic_endpoint
As pointed out in P2641R1, we can use GCC's __builtin_constant_p to
emulate the proposed std::is_active_member. This allows us to detect
which of the union members is active during constant evaluation, so we
don't need the extra bool data member. We still can't support constexpr
until C++20 though, as we need to change the active member during
constant evaluation.
libstdc++-v3/ChangeLog:
* include/experimental/internet (ip::basic_endpoint::_M_if_v6):
Revert change from member function to data member. Fix for
constant evaluation by detecting which union member is active.
(ip::basic_endpoint::resize): Revert changes to update _M_is_v6
flag.
Jakub Jelinek [Fri, 31 Mar 2023 11:41:34 +0000 (13:41 +0200)]
range-op-float, value-range: Fix up handling of UN{LT,LE,GT,GE,EQ}_EXPR and handle comparisons in get_tree_range [PR91645]
When looking into PR91645, I've noticed we handle UN{LT,LE,GT,GE,EQ}_EXPR
comparisons incorrectly.
All those are unordered or ..., we correctly return [1, 1] if one or
both operands are known NANs, and correctly ask the non-UN prefixed
op to fold_range if neither operand may be NAN.
But for the case where one or both operands may be NAN, we always
return [0, 1]. The UN* fold_range tries to handle it by asking
the non-UN prefixed fold_range and if it returns [1, 1] return that,
if it returns [0, 0] or [0, 1] return [0, 1], which makes sense,
because the maybe NAN means that it is the non-UN prefixed fold_range
unioned with [1, 1] in case the maybe NAN is actually NAN at runtime.
The problem is that the non-UN prefixed fold_range always returns [0, 1]
because those fold_range implementations are like:
if (op1.known_isnan () || op2.known_isnan ())
r = range_false (type);
else if (!maybe_isnan (op1, op2))
{
...
}
else
r = range_true_and_false (type);
and so if maybe_isnan, they always return [0, 1]. Now, thinking about it,
this is unnecessary pessimization, for the case where the ... block
returns range_false (type) we actually could do it also if maybe_isnan (op1,
op2), because if one or both operands are NAN, the comparison will be false,
and if neither is NAN, the comparison will be also false. Will fix
incrementally today.
Anyway, the following patch fixes it by asking the non-UN prefixed
fold_range on ranges with NAN cleared, which I think does the right
thing in all cases.
Another change in the patch is that range_query::get_tree_range
always returned VARYING for comparisons, this patch allows to ask about
those as well (they are very much like binary ops, except they take
the important type from the types of the operands rather than result).
Initially I've developed this patch together with changes to tree-call-cdce.cc,
but those result in one regression and apparently aren't actually needed to
fix this bug, the range-op-float.cc changes are enough.
2023-03-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91645
* range-op-float.cc (foperator_unordered_lt::fold_range,
foperator_unordered_le::fold_range,
foperator_unordered_gt::fold_range,
foperator_unordered_ge::fold_range,
foperator_unordered_equal::fold_range): Call the ordered
fold_range on ranges with cleared NaNs.
* value-query.cc (range_query::get_tree_range): Handle also
COMPARISON_CLASS_P trees.
* gcc.target/i386/pr103559-1.c: New test.
* gcc.target/i386/pr103559-2.c: New test.
* gcc.target/i386/pr103559-3.c: New test.
* gcc.target/i386/pr103559-4.c: New test.
Jonathan Wakely [Thu, 30 Mar 2023 12:03:11 +0000 (13:03 +0100)]
c++tools: Fix Makefile to properly clean and rebuild [PR101834]
The c++tools makefile doesn't remove progressively more files in each of
mostlyclean, clean, and distclean. Instead, each removes a different set
of files (and some files are not removed by any target). Use
prerequisites so that everything is removed.
Also, building in the $objdir/c++tools directory doesn't work, because
the INSTALL variable is never set. It works when building from the
top-level because INSTALL is set in the environment when recursively
invoking make for sub-directories.
c++tools/ChangeLog:
PR bootstrap/101834
* Makefile.in (INSTALL): Set variable.
(mostlyclean): Mark as a phony target.
(clean): Add mostlyclean as a prerequisite.
(distclean): Add clean as a prerequisite and remove more files.
(maintainer-clean): Add distclean as a prerequisite.
Kito Cheng [Fri, 31 Mar 2023 06:40:36 +0000 (14:40 +0800)]
RISC-V: Fix missing file dependency in RISC-V back-end [PR109328]
gcc/ChangeLog:
PR target/109328
* config/riscv/t-riscv: Add missing dependencies.
Co-authored-by: Andrew Pinski <pinskia@gmail.com>
liuhongt [Wed, 8 Feb 2023 03:03:14 +0000 (11:03 +0800)]
Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8.
It's impossible to put modes whose size > 8 into MASK_REGS.
gcc/ChangeLog:
* config/i386/i386.cc (inline_memory_move_cost): Return 100
for MASK_REGS when MODE_SIZE > 8.
Jonathan Yong [Mon, 27 Feb 2023 10:20:52 +0000 (10:20 +0000)]
c-c++-common/Warray-bounds.c: Fix excess warnings on LLP64
Excess errors on x86_64-w64-mingw32:
/home/user/p/gcc/src/gcc-git/gcc/testsuite/c-c++-common/Warray-bounds.c:50:3: warning: array subscript
4611686018427387902 is above array bounds of 'struct S16[]' [-Warray-bounds=]
/home/user/p/gcc/src/gcc-git/gcc/testsuite/c-c++-common/Warray-bounds.c:55:3: warning: array subscript
4611686018427387902 is above array bounds of 'struct S16[]' [-Warray-bounds=]
/home/user/p/gcc/src/gcc-git/gcc/testsuite/c-c++-common/Warray-bounds.c:90:3: warning: array subscript
658812288346769699 is above array bounds of 'struct S16[][7]' [-Warray-bounds=]
gcc/testsuite/ChangeLog:
* c-c++-common/Warray-bounds.c: Fix excess warnings on
LLP64.
Signed-off-by: Jonathan Yong <10walls@gmail.com>
liuhongt [Thu, 30 Mar 2023 07:43:25 +0000 (15:43 +0800)]
Rename ufix_trunc/ufloat* patterns to fixuns_trunc/floatuns* to align with standard pattern name.
There's some typo for the standard pattern name for unsigned_{float,fix},
it should be floatunsmn2/fixuns_truncmn2, not ufloatmn2/ufix_truncmn2
in current trunk, the patch fix the typo, also change all though
ufix_trunc/ufloat patterns.
Also vcvttps2udq is available under AVX512VL, so it can be generated
directly instead of being emulated via vcvttps2dq.
gcc/ChangeLog:
PR target/85048
* config/i386/i386-builtin.def (BDESC): Adjust icode name from
ufloat/ufix to floatuns/fixuns.
* config/i386/i386-expand.cc
(ix86_expand_vector_convert_uns_vsivsf): Adjust comments.
* config/i386/sse.md
(ufloat<sseintvecmodelower><mode>2<mask_name><round_name>):
Renamed to ..
(<mask_codefor>floatuns<sseintvecmodelower><mode>2<mask_name><round_name>):.. this.
(<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>):
Renamed to ..
(<mask_codefor><avx512>_fixuns_notrunc<sf2simodelower><mode><mask_name><round_name>):
.. this.
(<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>):
Renamed to ..
(fix<fixunssuffix>_truncv16sfv16si2<mask_name><round_saeonly_name>):.. this.
(ufloat<si2dfmodelower><mode>2<mask_name>): Renamed to ..
(floatuns<si2dfmodelower><mode>2<mask_name>): .. this.
(ufloatv2siv2df2<mask_name>): Renamed to ..
(<mask_codefor>floatunsv2siv2df2<mask_name>): .. this.
(ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>):
Renamed to ..
(fixuns_notrunc<mode><si2dfmodelower>2<mask_name><round_name>):
.. this.
(ufix_notruncv2dfv2si2): Renamed to ..
(fixuns_notruncv2dfv2si2):.. this.
(ufix_notruncv2dfv2si2_mask): Renamed to ..
(fixuns_notruncv2dfv2si2_mask): .. this.
(*ufix_notruncv2dfv2si2_mask_1): Renamed to ..
(*fixuns_notruncv2dfv2si2_mask_1): .. this.
(ufix_truncv2dfv2si2): Renamed to ..
(*fixuns_truncv2dfv2si2): .. this.
(ufix_truncv2dfv2si2_mask): Renamed to ..
(fixuns_truncv2dfv2si2_mask): .. this.
(*ufix_truncv2dfv2si2_mask_1): Renamed to ..
(*fixuns_truncv2dfv2si2_mask_1): .. this.
(ufix_truncv4dfv4si2<mask_name>): Renamed to ..
(fixuns_truncv4dfv4si2<mask_name>): .. this.
(ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>):
Renamed to ..
(fixuns_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>):
.. this.
(ufix_trunc<mode><sseintvecmodelower>2<mask_name>): Renamed to ..
(<mask_codefor>fixuns_trunc<mode><sseintvecmodelower>2<mask_name>):
.. this.
gcc/testsuite/ChangeLog:
* g++.target/i386/pr85048.C: New test.
GCC Administrator [Fri, 31 Mar 2023 00:17:02 +0000 (00:17 +0000)]
Daily bump.
Jason Merrill [Thu, 30 Mar 2023 03:27:38 +0000 (23:27 -0400)]
c++: anonymous union member reference [PR105452]
While parsing the anonymous union, we don't yet know that it's an anonymous
union, so we build the reference to 'v' in the static_assert relative to the
union type. But at instantiation time we know it's an anonymous union, so
we need to avoid trying to check access for 'v' in the union again; the
simplest approach seemed to be to make accessible_p step out to the
containing class.
While looking at this I also noticed that we were having trouble with DMI in
an anonymous union referring to members of the containing class; there
we just need to give current_class_ptr the right type.
PR c++/105452
gcc/cp/ChangeLog:
* search.cc (type_context_for_name_lookup): New.
(accessible_p): Handle anonymous union.
* init.cc (maybe_instantiate_nsdmi_init): Use
type_context_for_name_lookup.
* parser.cc (cp_parser_class_specifier): Likewise.
* cp-tree.h (type_context_for_name_lookup): Declare.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/anon8.C: New test.
Jason Merrill [Thu, 30 Mar 2023 15:07:17 +0000 (11:07 -0400)]
c++: generic lambda and function ptr conv [PR105221]
We weren't properly considering the function pointer conversions in
deduction between FUNCTION_TYPE; we just hardcoded the
UNIFY_ALLOW_MORE_CV_QUAL semantics, which are backwards when deducing for a
template conversion function like the one in a generic lambda. And when I
started checking the ALLOW flags, I needed to make sure they stay set to
avoid breaking trailing13.C.
PR c++/105221
gcc/cp/ChangeLog:
* pt.cc (unify) [FUNCTION_TYPE]: Handle function pointer
conversions.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/noexcept-type27.C: New test.
Gerald Pfeifer [Thu, 30 Mar 2023 21:41:24 +0000 (23:41 +0200)]
libiberty: Remove a reference to the Glibc manual
longjmp is not specific to Glibc, and GCC supports lots of systems
that do not use Glibc. Plus this link has been broken in the web
version for ages without a good way to fix.
libiberty/ChangeLog:
* obstacks.texi (Preparing for Obstacks): Remove a (broken)
reference to the Glibc manual.
Jakub Jelinek [Thu, 30 Mar 2023 21:08:25 +0000 (23:08 +0200)]
c++: Fix up ICE in build_min_non_dep_op_overload [PR109319]
The following testcase ICEs, because grok_array_decl during
processing_template_decl handling of a non-dependent subscript
emits a -Wcomma-subscript pedwarn, we decide to pass to the
single index argument the index expressions as if it was wrapped
with () around it, but then when preparing it for later instantiation
we don't actually take that into account and ICE on a mismatch of
number of index arguments (the overload expects a single index,
testcase has two index expressions in this case).
For non-dependent subscript which are builtin subscripts we also
emit the same pedwarn and don't ICE, but emit the same pedwarn
again whenever we instantiate it, which is also IMHO undesirable,
it is enough to warn once during parsing the template.
The following patch fixes it by turning even the original index expressions
(those which didn't go through make_args_non_dependent) into a single
index using comma expression(s).
2023-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/109319
* decl2.cc (grok_array_decl): After emitting a pedwarn for
-Wcomma-subscript, if processing_template_decl set orig_index_exp
to compound expr from orig_index_exp_list.
* g++.dg/cpp23/subscript14.C: New test.
Andrew MacLeod [Tue, 28 Mar 2023 16:16:34 +0000 (12:16 -0400)]
Add recursive GORI recompuations with a depth limit.
PR tree-optimization/109154
gcc/
* gimple-range-gori.cc (gori_compute::may_recompute_p): Add depth limit.
* gimple-range-gori.h (may_recompute_p): Add depth param.
* params.opt (ranger-recompute-depth): New param.
gcc/testsuite/
* gcc.dg/Walloca-13.c: Remove bogus warning that is now fixed.
Jason Merrill [Mon, 6 Mar 2023 20:33:45 +0000 (15:33 -0500)]
c++: lambda mangling alias issues [PR107897]
In 107897, by the time we are looking at the mangling clash, the
alias has already been removed from the symbol table by analyze_functions,
so we can't look at n->cpp_implicit_alias. So just assume that it's an
alias if it's internal.
In 108887 the problem is that removing the mangling alias from the symbol
table confuses analyze_functions, because it ended up as first_analyzed
somehow, so it becomes a dangling pointer. So instead we call reset()
to neutralize the alias. To make this work for variables, I needed to move
reset() from cgraph_node to symtab_node.
PR c++/107897
PR c++/108887
gcc/ChangeLog:
* cgraph.h: Move reset() from cgraph_node to symtab_node.
* cgraphunit.cc (symtab_node::reset): Adjust. Also call
remove_from_same_comdat_group.
gcc/cp/ChangeLog:
* decl2.cc (record_mangling): Use symtab_node::reset.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-lambda3.C: Use -flto if supported.
* g++.dg/cpp0x/lambda/lambda-mangle7.C: New test.
Richard Biener [Wed, 29 Mar 2023 11:49:24 +0000 (13:49 +0200)]
tree-optimization/107561 - reduce -Wstringop-overflow false positives
The following tells pointer-query to prefer a zero size when we
are querying for the size range for a write into an object we've
determined is of zero size. That avoids diagnostics about really
varying size arguments that just get a meaningful range for example
because they are multiplied by an element size.
I've adjusted only one call to get_size_range since that's what
I have a testcase for.
PR tree-optimization/107561
* gimple-ssa-warn-access.cc (get_size_range): Add flags
argument and pass it on.
(check_access): When querying for the size range pass
SR_ALLOW_ZERO when the known destination size is zero.
* g++.dg/pr71488.C: Remove XFAILed bogus diagnostic again.
* g++.dg/warn/Warray-bounds-16.C: Likewise.
Richard Biener [Thu, 30 Mar 2023 09:32:19 +0000 (11:32 +0200)]
tree-optimization/109342 - wrong code with edge equivalences in VN
The following testcase shows a problem in how we query valitity for
equivalences on edges when the edge is a backedge and thus refering
to a block thats later in the iteration order we use for VN. That
causes the dominated_by_p_w_unex helper to look at edge executable
state that's not yet computed and thus still at optimistic not
executable state.
The following makes sure to use a plain dominance check in these cases.
PR tree-optimization/109342
* tree-ssa-sccvn.cc (vn_nary_op_get_predicated_value): New
overload for edge. When that edge is a backedge use
dominated_by_p directly.
* g++.dg/torture/pr109342.C: New testcase.
Jakub Jelinek [Thu, 30 Mar 2023 07:34:12 +0000 (09:34 +0200)]
c++: Avoid informs without a warning [PR109278]
On the following testcase we emit notes in
maybe_inform_about_fndecl_for_bogus_argument_init
despite no warning/error being printed before it.
This is for the extended floating point type conversions where pedwarn
is used, and complained is used there for 2 different purposes,
one is whether an unspecific error should be emitted if we haven't
complained otherwise, and one whether
maybe_inform_about_fndecl_for_bogus_argument_init should be called.
For the 2 pedwarns, currently it sets complained to true regardless of
whether pedwarn succeeded, which results in the undesirable notes printed
with -w. If complained is initialized to result of pedwarn, we would
emit an error later on.
So, the following patch makes complained a tristate, the additional
error isn't printed if complained != 0, and
maybe_inform_about_fndecl_for_bogus_argument_init is called only if
complained == 1, so if pedwarn returns false, we can use complained = -1
to tell later code not to emit an error and not to call
maybe_inform_about_fndecl_for_bogus_argument_init.
2023-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/109278
* call.cc (convert_like_internal): If pedwarn for extended float
type conversions doesn't report anything, avoid calling
maybe_inform_about_fndecl_for_bogus_argument_init.
* g++.dg/cpp23/ext-floating15.C: New test.
Andrew Pinski [Wed, 29 Mar 2023 21:34:30 +0000 (21:34 +0000)]
Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.
The problem here is we were outputing long_long instead of
"long long". This was just an oversight and a missing check.
Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
gcc/fortran/ChangeLog:
* dump-parse-tree.cc (get_c_type_name): Fix "long_long"
type name to be "long long". Add a comment on why adding
2 to the name too.
liuhongt [Tue, 21 Mar 2023 05:37:59 +0000 (13:37 +0800)]
Generate vpblendd instead of vpblendw for V4SI under AVX2.
gcc/ChangeLog:
* config/i386/i386-expand.cc (expand_vec_perm_blend): Generate
vpblendd instead of vpblendw for V4SI under avx2.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr88828-0.c: Adjust testcase.
GCC Administrator [Thu, 30 Mar 2023 00:17:02 +0000 (00:17 +0000)]
Daily bump.
Jonathan Wakely [Wed, 29 Mar 2023 23:42:11 +0000 (00:42 +0100)]
libstdc++: Fix filename of new test [PR109242]
libstdc++-v3/ChangeLog:
PR libstdc++/109242
* testsuite/20_util/optional/monadic/pr109340.cc: Moved to...
* testsuite/20_util/optional/monadic/pr109242.cc: ...here.
Jonathan Wakely [Wed, 22 Mar 2023 17:00:11 +0000 (17:00 +0000)]
libstdc++: Fix constexpr functions in <experimental/internet>
Change ip::basic_endpoint to work in constant expressions, but only for
C++20 and later (due to the use of a union, which cannot change active
member in constexpr evaluation until C++20).
During constant evaluation we cannot inspect the common initial sequence
of basic_endpoint's union members to check whether sin_family == AF_INET
or AF_INET6. This means we need to store an additional boolean member
that remembers whether we have a v4 or v6 address. The address type can
change behind our backs if a user copies an address to the data()
pointer and then calls resize(n), so we need to inspect the sa_family_t
member in the union after a resize and update the boolean. POSIX only
guarantees that the sa_family_t member of each protocol-specific address
structure is at the same offset and of the same type, not that there is
a common initial sequence. The check in resize is done using memcmp, so
that we avoid accessing an inactive member of the union if the
sockaddr_in and sockaddr_in6 structures do not have a common initial
sequence that includes the sa_family_t member.
libstdc++-v3/ChangeLog:
* include/experimental/internet (ip::make_address): Implement
missing overload.
(ip::address_v4::broadcast()): Avoid undefined shift.
(ip::basic_endpoint): Fix member functions for constexpr.
(ip::basic_endpoint::_M_is_v6): Replace member function with
data member, adjust member functions using it.
(ip::basic_endpoint::resize): Update _M_is_v6 based on sockaddr
content.
* testsuite/experimental/net/internet/address/v4/cons.cc: Fix
constexpr checks to work in C++14.
* testsuite/experimental/net/internet/address/v4/creation.cc:
Likewise.
* testsuite/experimental/net/internet/endpoint/cons.cc:
Likewise.
* testsuite/experimental/net/internet/network/v4/cons.cc:
Likewise.
* testsuite/experimental/net/internet/network/v4/members.cc:
Likewise.
* testsuite/experimental/net/internet/endpoint/extensible.cc: New test.
Jonathan Wakely [Wed, 29 Mar 2023 21:43:16 +0000 (22:43 +0100)]
libstdc++: Apply small fix from LWG 3843 to std::expected
LWG 3843 adds some type requirements to std::expected::value to ensure
that it can correctly copy the error value if it needs to throw an
exception. We don't need to do anything to enforce that, because it will
already be ill-formed if the type can't be copied. The issue also makes
a small drive-by fix to ensure that a const E& is copied from the
non-const value()& overload, which this change implements.
libstdc++-v3/ChangeLog:
* include/std/expected (expected::value() &): Use const lvalue
for unex member passed to bad_expected_access constructor, as
per LWG 3843.
Jonathan Wakely [Wed, 29 Mar 2023 21:16:55 +0000 (22:16 +0100)]
libstdc++: Use std::remove_cv_t in std::optional::transform [PR109340]
We need to strip cv-qualifiers from the result of the callable passed to
std::optional::transform.
For std::expected::transform and std::expected::transform_error I
noticed we were stripping cv-qualifiers but were also incorrectly
stripping references.
libstdc++-v3/ChangeLog:
PR libstdc++/109340
* include/std/expected (expected::transform): Use
std::remove_cv_t instead of std::remove_cvref_t.
(expected::transform_error): Likewise.
(expected<cv void, E>::transform): Likewise.
(expected<cv void, E>::transform_error): Likewise.
* include/std/optional (transform): Use std::remove_cv_t.
* testsuite/20_util/optional/monadic/pr109340.cc: New test.
Jonathan Wakely [Wed, 29 Mar 2023 21:02:19 +0000 (22:02 +0100)]
libstdc++: Enforce requirements on template argument of std::optional
The standard does not allow std::optional<T&>, std::optional<T[1]>,
std::optional<T()> etc. and although we do give errors, they come from
down inside the internals of std::optional. We could improve the static
assertions at the top of the class so that users get a more precise
diagnostic:
optional:721:21: error: static assertion failed
721 | static_assert(is_object_v<_Tp> && !is_array_v<_Tp>);
libstdc++-v3/ChangeLog:
* include/std/optional (optional): Adjust static assertion to
reject arrays and functions as well as references.
* testsuite/20_util/optional/requirements_neg.cc: New test.
Hans-Peter Nilsson [Wed, 29 Mar 2023 22:56:13 +0000 (00:56 +0200)]
CRIS: Make rtx-cost 0 for many CONST_INT "quick" operands
Stepping through a gdb session inspecting costs that cause
gcc.dg/tree-ssa/slsr-13.c to fail, exposed that before this
patch, cris_rtx_costs told that a shift of 1 of a register
costs 5, while adding two registers costs 4.
Making the cost of a quick-immediate constant equal to using
a register (default 0) reflects actual performance and
size-cost better. It also happens to make
gcc.dg/tree-ssa/slsr-13.c pass with what looks like better
code being generated, and improves coremark performance by
0.4%.
But, blindly doing this for *all* valid operands that fit
the "quick-immediate" addressing mode, trips interaction
with other factors*, with the end result mixed at best. So,
do this only for MINUS and logical operations for the time
being, and only for modes that fit in one register.
*) Examples of "other factors":
- A bad default implementation of insn_cost or actually,
pattern_cost, that looks only at the set_src_cost and
furthermore sees such a cost of 0 as invalid. (Compare to
the more sane set_rtx_cost.) This naturally tripped up
combine and ifcvt, causing all sorts of changes, good and
bad.
- Having the same cost, to compare a register with 0 as with
-31..31, means a compare insn of an eliminable form no
longer looks preferable.
* config/cris/cris.cc (cris_rtx_costs) [CONST_INT]: Return 0
for many quick operands, for register-sized modes.
Gaius Mulley [Wed, 29 Mar 2023 16:38:22 +0000 (17:38 +0100)]
PR modula2/109336 - The -fmod= and -fdef= options do not work
The -fmod= and -fdef= options do not work. After the linking
re-implementation and subsequent restructuring the -fmod= amd -fdef= are
now broken. This patch adds -fmod= and -fdef= processing into gm2spec.cc.
It also reduces the complexity of extension handling within M2Search
by storing the preceeding "." in the extension.
gcc/m2/ChangeLog:
PR modula2/109336
PR modula2/109315
* gm2-compiler/M2FileName.mod (CalculateFileName): Simplified by
ensuring the extension contains the ".".
(CalculateStemName): Re-formatted.
(ExtractExtension): Re-formatted.
(ExtractModule): Re-formatted.
* gm2-compiler/M2Options.def (setdefextension): Add block comment.
(setmodextension): Add block comment. Re-formatted.
* gm2-compiler/M2Options.mod (setdefextension): Add block comment.
(setmodextension): Add block comment. Re-formatted.
* gm2-compiler/M2Search.mod (FindSourceDefFile): Use
DefaultDefExt.
(DefaultDefExt): New constant.
(DefaultModExt): New constant.
(FindSourceModFile): Use DefaultModExt.
* gm2-gcc/m2decl.cc (m2decl_DeclareKnownVariable): Correct
spelling.
* gm2spec.cc (M2SOURCE): New constant.
(LANGSPEC): New value.
(MATHLIB): New value.
(WITHLIBC): New value.
(SKIPOPT): New value.
(lang_specific_driver): Replace seen_module_extension bool with
module_extension char *. Detect -fmod= and remember extension.
Use the extension to detect modula-2 source and mark it as such.
gcc/testsuite/ChangeLog:
PR modula2/109336
* gm2/link/nondefaultext/pass/hello.md: New test.
* gm2/link/nondefaultext/pass/liba.dm: New test.
* gm2/link/nondefaultext/pass/liba.md: New test.
* gm2/link/nondefaultext/pass/link-nondefaultext-pass.exp: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Jiawei [Tue, 28 Mar 2023 16:55:15 +0000 (00:55 +0800)]
RISC-V: Add Z*inx imcompatible check in gcc
Z*inx is conflict with float extensions, add incompatible check when
z*inx and f extension both enabled.
Since all float extension imply f extension and all z*inx extension
imply zfinx extension, so we just need to check f with zfinx extension
as the base case.
Co-Authored by: Kito Cheng <kito.cheng@gmail.com>
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc (riscv_subset_list::parse):
New check.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/arch-19.c: New test.
Martin Liska [Wed, 29 Mar 2023 12:52:42 +0000 (14:52 +0200)]
configure: deprecate --enable-link-mutex option
PR bootstrap/109310
gcc/ChangeLog:
* configure.ac: Emit a warning for deprecated option
--enable-link-mutex.
* configure: Regenerate.
Richard Biener [Wed, 29 Mar 2023 09:59:16 +0000 (11:59 +0200)]
tree-optimization/109331 - make sure to clean up the CFG after forwprop
When forwprop discovers unreachable code or makes decisions based
on unreachable edges make sure to cleanup the CFG since otherwise
SSA form can become invalid.
PR tree-optimization/109331
* tree-ssa-forwprop.cc (pass_forwprop::execute): When we
discover a taken edge make sure to cleanup the CFG.
* gcc.dg/torture/pr109331.c: New testcase.
Richard Biener [Wed, 29 Mar 2023 08:45:14 +0000 (10:45 +0200)]
scan generic vector tests before lowering
The g++.dg/pr94920.C testcase looks for a specific number of
ABS_EXPRs but the vector example is prone to vector lowering so
the following instead of scanning the optimized dump scans the
forwprop1 dump which is before vector lowering and the point the
transforms should have happened.
* g++.dg/pr94920.C: Scan forwprop1 instead of optimized.
Richard Biener [Wed, 29 Mar 2023 07:51:58 +0000 (09:51 +0200)]
tree-optimization/109327 - forwprop stmt removal issue
There's interfering between the to_removed queue and other mechanisms
removing stmts, in this case remove_prop_source_from_use. The following
makes the to_remove queue draining more permissive.
PR tree-optimization/109327
* tree-ssa-forwprop.cc (pass_forwprop::execute): Deal with
already removed stmts when draining to_remove.
* gcc.dg/pr109327.c: New testcase.
Richard Biener [Mon, 27 Mar 2023 14:40:15 +0000 (16:40 +0200)]
ipa/106124 - ICE with -fkeep-inline-functions and OpenMP
The testcases in this bug reveal cases where an early generated
type is collected because it was unused but gets attempted to
be recreated later when a late DIE for a function (an OpenMP
reduction) is created. That's unexpected and possibly the fault
of OpenMP but the following allows the re-creation of the context
type to succeed.
PR ipa/106124
* dwarf2out.cc (lookup_type_die): Reset TREE_ASM_WRITTEN
so we can re-create the DIE for the type if required.
* g++.dg/gomp/pr106124.C: New testcase.
Jakub Jelinek [Wed, 29 Mar 2023 06:33:30 +0000 (08:33 +0200)]
tree-ssa-math-opts: Move PROP_gimple_opt_math from sincos pass to powcabs [PR109301]
The following testcase ICEs since the sincos and vect pass order has
been swapped. It is not valid to replace vector sqrt (sqrt (x)) with
pow (x, 0.25) because build_real on vector type is invalid (could be
handled by using build_uniform_cst and adjusting type passed to
build_real) but more importantly because nothing checks if we can
actually do vector pow.
While we have pow_optab, apparently no target defines it, so it doesn't
seem to be worth bothering with for now and the patch just punts on
non-scalar sqrts.
I think the other simplifications next to it are fine, as they mostly
use CBRT which doesn't even have internal function (so is a builtin
only and therefore always scalar), or have already pow in the IL (which
doesn't have optab and shouldn't be thus vector either).
It is true that with <bits/math-vector.h> we do vectorize some calls to
pow or cbrt (but don't handle others strangely), but those aren't using
internal functions but simd clones and so match.pd doesn't know anything
about those (at least for now).
The following patch fixes it by mostly restoring the state before
r13-1763 where canonicalize_math_p () was true only until the end of the
pass which transformed pow or pow-like calls before vectorization (formerly
sincos pass, now it is powcabs pass).
powcabs is a pass in the spot sincos was happening before, so the
only change was defer the sin+cos simplification into cexpi to a later
new pass (except for the name moving with it) and none of the
canonicalize_math_p () guarded simplification in match.pd seem to rely
on those sin+cos -> cexpi simplifications and canonicalize_math_p is
the only user of this property.
2023-03-29 Jakub Jelinek <jakub@redhat.com>
Richard Biener <rguenther@suse.de>
PR tree-optimization/109301
* tree-ssa-math-opts.cc (pass_data_cse_sincos): Change
properties_provided from PROP_gimple_opt_math to 0.
(pass_data_expand_powcabs): Change properties_provided from 0 to
PROP_gimple_opt_math.
* gcc.dg/pr109301.c: New test.
Richard Biener [Tue, 28 Mar 2023 13:20:22 +0000 (15:20 +0200)]
tree-optimization/109154 - improve if-conversion for vectorization
With multi-argument PHIs and now doing VN on the if-converted blocks
the optimization of CSEing condition and negated condition doesn't
work well anymore. The following restores this a little bit for
the case of a single inverted condition into a COND_EXPR where
we can instead swap the COND_EXPR arms. The same optimization
is already done for the case of two-argument PHIs.
This avoids one comparison/mask for the testcase at hand.
PR tree-optimization/109154
* tree-if-conv.cc (gen_phi_arg_condition): Handle single
inverted condition specially by inverting at the caller.
(gen_phi_arg_condition): Swap COND_EXPR arms if requested.
Jason Merrill [Tue, 28 Mar 2023 21:42:23 +0000 (17:42 -0400)]
c++: alias ctad refinements [PR109321]
The two hunks fix missing handling demonstrated by the two testcases: first,
if we omit one alias template parm but include another, we need to rewrite
the deduced template args to reflect the new position of the included parm.
Second, if we can't deduce any template args for a parameter pack, it is
deduced to an empty pack.
PR c++/109321
PR c++/109320
gcc/cp/ChangeLog:
* pt.cc (alias_ctad_tweaks): Rewrite deduced args.
(type_targs_deducible_from): Handle null pack deduction.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/class-deduction-alias16.C: New test.
* g++.dg/cpp2a/class-deduction-alias17.C: New test.
Ian Lance Taylor [Tue, 28 Mar 2023 20:01:28 +0000 (13:01 -0700)]
compiler: mark Call_expression multiple results as a result struct
In https://go.dev/cl/343873 we stopped padding zero-sized trailing
fields in functions that return multiple results where the last result
is zero-sized. This CL makes the corresponding change on the caller side.
The test case is https://go.dev/cl/479898.
Fixes golang/go#55242
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/479955
GCC Administrator [Wed, 29 Mar 2023 00:17:01 +0000 (00:17 +0000)]
Daily bump.
Joseph Myers [Tue, 28 Mar 2023 23:46:40 +0000 (23:46 +0000)]
Update gcc de.po
* de.po: Update.
Jonathan Wakely [Tue, 28 Mar 2023 20:07:21 +0000 (21:07 +0100)]
libstdc++: Do not use facets cached in ios for ATL128 build [PR103387]
For the powerpc64le build with two different long double
representations, we cannot use the ios_base::_M_num_put and
ios_base::_M_num_get pointers, because they might have been initialized
in a translation unit using the other long double type. With the changes
to add __try_use_facet to GCC 13 the cache isn't really needed now, we
can just access the right facet in the locale directly, without needing
RTTI checks.
libstdc++-v3/ChangeLog:
PR libstdc++/103387
* include/bits/istream.tcc (istream::_M_extract(ValueT&)): Use
std::use_facet instead of cached _M_num_get facet.
(istream::operator>>(short&)): Likewise.
(istream::operator>>(int&)): Likewise.
* include/bits/ostream.tcc (ostream::_M_insert(ValueT)): Use
std::use_facet instead of cached _M_num_put facet.
Thomas Schwinge [Tue, 28 Mar 2023 20:26:30 +0000 (22:26 +0200)]
Enable 'gfortran.dg/weak-2.f90' for nvptx target
Follow-up to commit
bcbeebc498126c50d73809ec8a4bd0bff27ee97b
"Fortran: Add support for WEAK attribute for variables".
gcc/testsuite/
* gfortran.dg/weak-2.f90: Enable for nvptx target.
Jonathan Wakely [Tue, 28 Mar 2023 10:12:58 +0000 (11:12 +0100)]
libstdc++: More fixes for null pointers used with std::char_traits
The std::char_traits member functions require that [p,p+n) is a valid
range, which is true for p==nullptr iff n==0. But we must not call
memcpy, memset etc, in that case, as they require non-null pointers even
when n==0.
This std::char_traits<char> and std::char_traits<wchar_t> explicit
specializations are already correct, but the primary template has some
bugs.
libstdc++-v3/ChangeLog:
* include/bits/char_traits.h (char_traits::copy): Return without
using memcpy if n==0.
(char_traits::assign): Likewise for memset.
Jonathan Wakely [Tue, 28 Mar 2023 09:50:40 +0000 (10:50 +0100)]
libstdc++: Tell GCC what basic_string::_M_is_local() means [PR109299]
This avoids a bogus warning about overflowing a buffer, because GCC
can't tell that we don't copy into the buffer unless it fits. By adding
a __builtin_unreachable() hint we inform the compiler about the
invariant that the buffer is only used when it's big enough.
This can also improve codegen, by eliminating dead code that GCC
couldn't tell was unreachable.
libstdc++-v3/ChangeLog:
PR libstdc++/109299
* include/bits/basic_string.h (basic_string::_M_is_local()): Add
hint for compiler that local strings fit in the local buffer.
Jonathan Wakely [Mon, 27 Mar 2023 12:51:25 +0000 (13:51 +0100)]
libstdc++: Update tzdata to 2023a [PR109288]
Import the new 2023a tzdata.zi file and update the expiry dates of the
hardcoded lists of leapseconds to 2023-12-28.
With the new data, Africa/Egypt no longer has a single unbroken sys_info
from 2014-09-25 to chrono::year::max(). Only check up to 2014-09-01 so
that the test isn't sensitive to differences between 2022g and 2023a
data.
libstdc++-v3/ChangeLog:
PR libstdc++/109288
* include/std/chrono (__detail::__get_leap_second_info): Update
expiry date of hardcoded leapseconds list.
* src/c++20/tzdb.cc (tzdb_list::_Node::_S_read_leap_seconds()):
Likewise.
* src/c++20/tzdata.zi: Import new file from 2023a release.
* testsuite/std/time/time_zone/get_info_local.cc: Only check
transitions for Egypt up to 2014.
Ian Lance Taylor [Tue, 28 Mar 2023 20:08:42 +0000 (13:08 -0700)]
libbacktrace: minor fixes for zstd decompression
* elf.c (elf_zstd_read_fse): Call elf_fetch_bits after reading
bits, not before. Add unlikely for error case.
(elf_zstd_offset_table): Regenerate.
(elf_zstd_read_huff): Clear 13 entries in weight_mark, not 12.
(elf_zstd_read_literals): For a single stream adjust by
total_streams_size, not compressed_size.
David Malcolm [Tue, 28 Mar 2023 18:34:49 +0000 (14:34 -0400)]
Don't emit -Wxor-used-as-pow on macro expansions [PR107002]
PR c/107002 reports an assertion failure from deep inside the
diagnostic_shows_locus when attempting to print fix-it hints relating
to -Wxor-used-as-pow. The case involves macro expansions with
-ftrack-macro-expansion=0.
It doesn't seem to make much sense to emit this warning for macro
expansions, so this patch updates the warning not to (which seems
to also be clang's behavior). The patch also adds some bulletproofing
to diagnostic-show-locus.cc to be more robust against such invalid
fix-it hints.
Doing so fixes the ICE.
gcc/c-family/ChangeLog:
PR c/107002
* c-common.h (check_for_xor_used_as_pow): Add "rhs_loc" param.
* c-warn.cc (check_for_xor_used_as_pow): Add "rhs_loc" param.
Reject cases where involving macro expansions.
gcc/c/ChangeLog:
PR c/107002
* c-typeck.cc (parser_build_binary_op): Update for new param of
check_for_xor_used_as_pow.
gcc/cp/ChangeLog:
PR c/107002
* parser.cc (cp_parser_binary_expression): Update for new param of
check_for_xor_used_as_pow.
gcc/ChangeLog:
PR c/107002
* diagnostic-show-locus.cc (column_range::column_range): Factor
out assertion conditional into...
(column_range::valid_p): ...this new function.
(line_corrections::add_hint): Don't attempt to consolidate hints
if it would lead to invalid column_range instances.
gcc/testsuite/ChangeLog:
PR c/107002
* c-c++-common/Wxor-used-as-pow-1.c: Add macro test.
* c-c++-common/Wxor-used-as-pow-pr107002-0.c: New test.
* c-c++-common/Wxor-used-as-pow-pr107002-1.c: New test.
* c-c++-common/Wxor-used-as-pow-pr107002-2.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Jakub Jelinek [Tue, 28 Mar 2023 15:49:23 +0000 (17:49 +0200)]
c++: Allow translations of check_postcondition_result messages [PR109309]
As mentioned in the PR, constructing a message from two parts by
concatenating them prevents translations, unless one of the parts
is a keyword which should be never translated.
The following patch fixes that.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
PR c++/109309
* contracts.cc: Include intl.h.
(check_postcondition_result): Don't form diagnostics from two halves
of an English message to allow translations.
Jason Merrill [Thu, 23 Mar 2023 19:57:39 +0000 (15:57 -0400)]
c-family: -Wsequence-point and COMPONENT_REF [PR107163]
The patch for PR91415 fixed -Wsequence-point to treat shifts and ARRAY_REF
as sequenced in C++17, and COMPONENT_REF as well. But this is unnecessary
for COMPONENT_REF, since the RHS is just a FIELD_DECL with no actual
evaluation, and in this testcase handling COMPONENT_REF as sequenced blows
up fast in a deep inheritance tree. Instead, look through it.
PR c++/107163
gcc/c-family/ChangeLog:
* c-common.cc (verify_tree): Don't use sequenced handling
for COMPONENT_REF.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wsequence-point-5.C: New test.
Kito Cheng [Tue, 28 Mar 2023 14:21:50 +0000 (22:21 +0800)]
RISC-V: Define __riscv_v_intrinsic [PR109312]
RVV intrinsic has defined a macro to identity the version of RVV
intrinsic spec, we missed that before, thanksful we are catch this
before release.
gcc/ChangeLog:
PR target/109312
* config/riscv/riscv-c.cc (riscv_ext_version_value): New.
(riscv_cpu_cpp_builtins): Define __riscv_v_intrinsic and
minor refactor.
gcc/testsuite/ChangeLog:
PR target/109312
* gcc.target/riscv/predef-__riscv_v_intrinsic.c: New test.
Matthias Kretz [Wed, 22 Mar 2023 07:12:08 +0000 (08:12 +0100)]
libstdc++: Add missing trait is_simd_flag_type
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h (is_simd_flag_type): New.
(_IsSimdFlagType): New.
(copy_from, copy_to, load ctors): Constrain _Flags using
_IsSimdFlagType.
Alexander Monakov [Tue, 28 Mar 2023 13:00:37 +0000 (16:00 +0300)]
haifa-sched: fix autopref_rank_for_schedule comparator [PR109187]
Do not attempt to use a plain subtraction for generating a three-way
comparison result in autopref_rank_for_schedule qsort comparator, as
offsets are not restricted and subtraction may overflow. Open-code
a safe three-way comparison instead.
gcc/ChangeLog:
PR rtl-optimization/109187
* haifa-sched.cc (autopref_rank_for_schedule): Avoid use of overflowing
subtraction in three-way comparison.
gcc/testsuite/ChangeLog:
PR rtl-optimization/109187
* gcc.dg/pr109187.c: New test.
Andrew MacLeod [Fri, 24 Mar 2023 15:21:20 +0000 (11:21 -0400)]
Fix compute_operand when op1 == op2 symbolically.
First, class value_relation should not sanitize records. just create
what is asked.
Second., if there is not a relation record, compute_operand was
creating one for op1 == op2 if op1 and op2 were the same symbol. This
is not the correct way to communicate the information, as that record
will continue to be passed along the GORI unwind chain.
Instead, simply pass that information locally to the opX_range routine
for only the current statement.
PR tree-optimization/109265
PR tree-optimization/109274
gcc/
* gimple-range-gori.cc (gori_compute::compute_operand_range): Do
not create a relation record is op1 and op2 are the same symbol.
(gori_compute::compute_operand1_range): Pass op1 == op2 to the
handler for this stmt, but create a new record only if this statement
generates a relation based on the ranges.
(gori_compute::compute_operand2_range): Ditto.
* value-relation.h (value_relation::set_relation): Always create the
record that is requested.
gcc/testsuite/
* gcc.dg/pr109274.c: New.
* gfortran.dg/pr109265.f90: New.
Richard Biener [Mon, 27 Mar 2023 13:18:41 +0000 (15:18 +0200)]
tree-optimization/107087 - missed CCP after forwprop
When forwprop simplifies the CFG the 2nd order opportunities by
exposed degenerate PHIs are not realized. The following improves
this by properly tracking executable edges and thus handling this
for non-cyclic CFGs at least.
This avoids the bogus diagnostic reported for the testcase in this PR.
PR tree-optimization/107087
* tree-ssa-forwprop.cc (pass_forwprop::execute): Track
executable regions to avoid useless work and to better
propagate degenerate PHIs.
* g++.dg/pr107087.C: New testcase.
Costas Argyris [Tue, 28 Mar 2023 10:29:06 +0000 (11:29 +0100)]
mingw: Fix comments in x-mingw32-utf8
This is a comment-only change that I should have
done with the previous commit (
304c7d44a) but
forgot to do so.
gcc/ChangeLog:
* config/i386/x-mingw32-utf8: update comments.
Signed-off-by: Jonathan Yong <10walls@gmail.com>
Richard Sandiford [Tue, 28 Mar 2023 11:34:51 +0000 (12:34 +0100)]
aarch64: Restore vectorisation of vld1 inputs [PR109072]
Before GCC 12, we would vectorize:
int32_t arr[] = { x, x, x, x };
at -O3. Vectorizing the store on its own is often a loss, particularly
for integers, so g:
4963079769c99c4073adfd799885410ad484cbbe suppressed it.
This was necessary to fix regressions from enabling vectorisation at -O2,
However, the vectorisation is important if the code subsequently loads
from the array using vld1:
return vld1q_s32 (arr);
This approach of initialising an array and loading from it is the
recommend endian-agnostic way of constructing an ACLE vector.
As discussed in the PR notes, the general fix would be to fold the
store and load-back to a constructor (preferably before vectorisation).
But that's clearly not stage 4 material.
This patch instead delays folding vld1 until after inlining and
records which decls a vld1 loads from. It then treats vector
stores to those decls as free, on the optimistic assumption that
they will be removed later. The patch also brute-forces
vectorization of plain constructor+store sequences, since some
of the CPU costs make that (dubiously) expensive even when the
store is discounted.
Delaying folding showed that we were failing to update the vops.
The patch fixes that too.
Thanks to Tamar for discussion & help with testing.
gcc/
PR target/109072
* config/aarch64/aarch64-protos.h (aarch64_vector_load_decl): Declare.
* config/aarch64/aarch64.h (machine_function::vector_load_decls): New
variable.
* config/aarch64/aarch64-builtins.cc (aarch64_record_vector_load_arg):
New function.
(aarch64_general_gimple_fold_builtin): Delay folding of vld1 until
after inlining. Record which decls are loaded from. Fix handling
of vops for loads and stores.
* config/aarch64/aarch64.cc (aarch64_vector_load_decl): New function.
(aarch64_accesses_vector_load_decl_p): Likewise.
(aarch64_vector_costs::m_stores_to_vector_load_decl): New member
variable.
(aarch64_vector_costs::add_stmt_cost): If the function has a vld1
that loads from a decl, treat vector stores to those decls as
zero cost.
(aarch64_vector_costs::finish_cost): ...and in that case,
if the vector code does nothing more than a store, give the
prologue a zero cost as well.
gcc/testsuite/
PR target/109072
* gcc.target/aarch64/pr109072_1.c: New test.
* gcc.target/aarch64/pr109072_2.c: Likewise.
Richard Biener [Tue, 28 Mar 2023 10:42:14 +0000 (12:42 +0200)]
bootstrap/84402 - improve (match ...) code generation
The following avoids duplicating matching code for (match ...)
in match.pd when possible. That's more easily possible for
(match ...) than simplify because we do not need to handle
common matches (those would be diagnosed only during compiling)
nor is the result able to inspect the active operator.
Specifically this reduces the size of the generated matches for
the atomic ops as noted in PR108129.
gimple-match.cc shrinks from 245k lines to 209k lines with this patch.
PR bootstrap/84402
PR tree-optimization/108129
* genmatch.cc (lower_for): For (match ...) delay
substituting into the match operator if possible.
(dt_operand::gen_gimple_expr): For user_id look at the
first substitute for determining how to access operands.
(dt_operand::gen_generic_expr): Likewise.
(dt_node::gen_kids): Properly sort user_ids according
to their substitutes.
(dt_node::gen_kids_1): Code-generate user_id matching.
Matthias Kretz [Wed, 22 Mar 2023 07:12:08 +0000 (08:12 +0100)]
libstdc++: Fix operator% implementation for Clang
This resolves a regression of my previous fix where Clang would ICE on
_S_divides.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd_x86.h (_SimdImplX86): Use
_Base::_S_divides if the optimized _S_divides function is hidden
via the preprocessor.
Jakub Jelinek [Tue, 28 Mar 2023 09:53:59 +0000 (11:53 +0200)]
gcov-tool: Use subcommand rather than sub-command in function comments
Follow-up to the recently committed fix of fixing the "subcomand" typos
in diagnostics.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
* gcov-tool.cc (do_merge, do_merge_stream, do_rewrite, do_overlap):
Use subcommand rather than sub-command in function comments.
Jakub Jelinek [Tue, 28 Mar 2023 09:39:46 +0000 (11:39 +0200)]
openmp: Fix typo in diagnostics [PR109314]
Trivial typo fix.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
PR fortran/109314
* openmp.cc (gfc_omp_absent_contains_clause): Fix typo in diagnostics
- composit -> composite.
Jakub Jelinek [Tue, 28 Mar 2023 09:00:32 +0000 (11:00 +0200)]
range-op-float: Only flush_denormals_to_zero for +-*/ [PR109154]
As discussed in the PR, flushing denormals to zero on every frange::set
might be harmful for e.g. x < 0.0 comparisons, because we then on both
sides use ranges that include zero [-Inf, -0.0] on the true side, and
[-0.0, +Inf] NAN on the false side, rather than [-Inf, nextafter (-0.0, -Inf)]
on the true side.
The following patch does it only in range_operator_float::fold_range
which is right now used for +-*/ (both normal and reverse ops of those).
Though, I don't see any difference on the testcase in the PR, but not sure
what I should be looking at and the reduced testcase there has undefined
behavior.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/109154
* value-range.h (frange::flush_denormals_to_zero): Make it public
rather than private.
* value-range.cc (frange::set): Don't call flush_denormals_to_zero
here.
* range-op-float.cc (range_operator_float::fold_range): Call
flush_denormals_to_zero.
Jakub Jelinek [Tue, 28 Mar 2023 08:56:44 +0000 (10:56 +0200)]
sanopt: Return TODO_cleanup_cfg if any .{UB,HWA,A}SAN_* calls were lowered [PR106190]
The following testcase ICEs, because without optimization eh lowering
decides not to duplicate finally block of try/finally and so we end up
with variable guarded cleanup. The sanopt pass creates a cfg that ought
to be cleaned up (some IFN_UBSAN_* functions are lowered in this case with
constant conditions in gcond and when not allowing recovery some bbs which
end with noreturn calls actually have successor edges), but the cfg cleanup
is actually (it is -O0) done only during the optimized pass. We notice
there that the d[1][a] = 0; statement which has an EH edge is unreachable
(because ubsan would always abort on the out of bounds d[1] access), remove
the EH landing pad and block, but because that block just sets a variable
and jumps to another one which tests that variable and that one is reachable
from normal control flow, the __builtin_eh_pointer (1) later in there is
kept in the IL and we ICE during expansion of that statement because the
EH region has been removed.
The following patch fixes it by doing the cfg cleanup already during
sanopt pass if we create something that might need it, while the EH
landing pad is then removed already during sanopt pass, there is ehcleanup
later and we don't ICE anymore.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/106190
* sanopt.cc (pass_sanopt::execute): Return TODO_cleanup_cfg if any
of the IFN_{UB,HWA,A}SAN_* internal fns are lowered.
* gcc.dg/asan/pr106190.c: New test.
Jakub Jelinek [Tue, 28 Mar 2023 08:55:31 +0000 (10:55 +0200)]
range-op-float: Use get_nan_state in float_widen_lhs_range
On Wed, Mar 22, 2023 at 07:32:44AM +0100, Aldy Hernandez wrote:
> * value-range.cc (frange::set): Add nan_state argument.
> * value-range.h (class nan_state): New.
> (frange::get_nan_state): New.
The following patch makes use of those changes in float_widen_lhs_range.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
* range-op-float.cc (float_widen_lhs_range): Use pass get_nan_state
as 4th argument to set to avoid clear_nan and union_ calls.
Eric Botcazou [Tue, 28 Mar 2023 08:44:06 +0000 (10:44 +0200)]
Fix line ending
gcc/testsuite/
* gcc.target/sparc/
20230328-1.c: New test.
* gcc.target/sparc/
20230328-2.c: Likewise.
* gcc.target/sparc/
20230328-3.c: Likewise.
* gcc.target/sparc/
20230328-4.c: Likewise.
Jakub Jelinek [Tue, 28 Mar 2023 08:43:08 +0000 (10:43 +0200)]
i386: Require just 32-bit alignment for SLOT_FLOATxFDI_387 -m32 -mpreferred-stack-boundary=2 DImode temporaries [PR109276]
The following testcase ICEs since r11-2259 because assign_386_stack_local
-> assign_stack_local -> ix86_local_alignment now uses 64-bit alignment
for DImode temporaries rather than 32-bit as before.
Most of the spots in the backend which ask for DImode temporaries are during
expansion and those apparently are handled fine with -m32
-mpreferred-stack-boundary=2, we dynamically realign the stack in that case
(most of the spots actually don't need that alignment but at least one
does), then 2 spots are in STV which I assume also work correctly.
But during splitting we can create a DImode slot which doesn't need to be
64-bit alignment (it is nicer for performance though), when we apparently
aren't able to detect it for dynamic stack realignment purposes.
The following patch just makes the slot 32-bit aligned in that rare case.
2023-03-28 Jakub Jelinek <jakub@redhat.com>
PR target/109276
* config/i386/i386.cc (assign_386_stack_local): For DImode
with SLOT_FLOATxFDI_387 and -m32 -mpreferred-stack-boundary=2 pass
align 32 rather than 0 to assign_stack_local.
* gcc.target/i386/pr109276.c: New test.
Eric Botcazou [Tue, 28 Mar 2023 08:13:24 +0000 (10:13 +0200)]
Fix PR target/109140
This is a regression present on the mainline and 12 branch at -O2, but the
issue is related to vectorization so was present at -O3 in earlier versions.
The vcondu expander that was added for VIS 3 more than a decade ago does not
fully work, because it does not filter out the unsigned condition codes (the
instruction is an UNSPEC that accepts only signed condition codes).
While I was at it, I also added the missing vcond and vcondu expanders for
the new comparison instructions that were added in VIS 4.
gcc/
PR target/109140
* config/sparc/sparc.cc (sparc_expand_vcond): Call signed_condition
on operand #3 to get the final condition code. Use std::swap.
* config/sparc/sparc.md (vcondv8qiv8qi): New VIS 4 expander.
(fucmp<gcond:code>8<P:mode>_vis): Move around.
(fpcmpu<gcond:code><GCM:gcm_name><P:mode>_vis): Likewise.
(vcondu<GCM:mode><GCM:mode>): New VIS 4 expander.
gcc/testsuite/
* gcc.target/sparc/
20230328-1.c: New test.
* gcc.target/sparc/
20230328-2.c: Likewise.
* gcc.target/sparc/
20230328-3.c: Likewise.
* gcc.target/sparc/
20230328-4.c: Likewise.
Eric Botcazou [Mon, 27 Mar 2023 16:27:17 +0000 (18:27 +0200)]
Modula-2: fix documentation layout again
Nothing really serious this time.
gcc/
* doc/gm2.texi: Add missing Next, Previous and Top fields to most
top-level sections.
Rainer Orth [Tue, 28 Mar 2023 08:40:05 +0000 (10:40 +0200)]
testsuite: Fix weak_undefined handling on Darwin
The patch that introduced the weak_undefined effective-target keyword
and corresponding dg-add-options support
commit
378ec7b87a5265dbe2d489c245fac98ef37fa638
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Mar 23 00:45:05 2023 -0300
[testsuite] test for weak_undefined support and add options
badly broke the affected tests on macOS like so:
ERROR: gcc.dg/addr_equal-1.c: unknown dg option: 89 for " dg-add-options 5 weak_undefined "
ERROR: gcc.dg/addr_equal-1.c: unknown dg option: 89 for " dg-add-options 5 weak_undefined "
add_options_for_weak_undefined tries to call an non-existant proc "89".
Even after fixing this by escaping the brackets, two tests still failed to
link since they lacked the corresponding calls do dg-add-options
weak_undefined.
Tested on x86_64-apple-darwin20.6.0 and i386-pc-solaris2.11.
2023-03-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc/testsuite:
* lib/target-supports.exp (add_options_for_weak_undefined): Escape
brackets.
* gcc.dg/visibility-22.c: Add weak_undefined options.
libgomp:
* testsuite/libgomp.oacc-c-c++-common/routine-nohost-2.c: Add
weak_undefined options.
Costas Argyris [Sun, 26 Mar 2023 10:32:13 +0000 (11:32 +0100)]
Extend UTF-8 support to the 32-bit mingw host.
Prevent any name mangling in HOST_EXTRA_OBJS_SYMBOL
such that the linker always finds it by that name.
Also add the .manifest file as an explicit
dependency in the make rule such that the
object gets re-built if it changes.
gcc/ChangeLog:
* config.host: Pull in i386/x-mingw32-utf8 Makefile
fragment and reference utf8rc-mingw32.o explicitly
for mingw hosts.
* config/i386/sym-mingw32.cc: prevent name mangling of
stub symbol.
* config/i386/x-mingw32-utf8: Make utf8rc-mingw32.o
depend on manifest file explicitly.
Signed-off-by: Jonathan Yong <10walls@gmail.com>
Richard Biener [Tue, 28 Mar 2023 07:31:36 +0000 (09:31 +0200)]
Revert "rtl-optimization/109237 - speedup bb_is_just_return"
This reverts commit
776a5bb5894315ab144dc74222fc580fde8fdd87.
PR rtl-optimization/109311
* cfgcleanup.cc (bb_is_just_return): Revert previous change.
Xi Ruoyao [Mon, 27 Mar 2023 17:48:02 +0000 (01:48 +0800)]
fixincludes: Declare memmem if it's not declared in system headers [PR109293]
memmem is not POSIX so the system may lack it. Then libiberty will
provide an implementation, but it's a "supplemental function" and not
declared in libiberty.h. We need to declare the prototype to use it
then.
See libiberty doc at
https://gcc.gnu.org/onlinedocs/libiberty/Supplemental-Functions.html.
Tested by bootstrapping GCC in the following container environments on
x86_64-linux-gnu:
1. "Vanilla" system with memmem in Glibc.
2. memmem removed from string.h.
3. memmem removed from both string.h and libc.so.
For 3, also verified that memmem from libiberty is linked into fixincl
executable.
Ok for trunk?
fixincludes/ChangeLog:
PR other/109293
* configure.ac (AC_CHECK_DECLS): Add memmem.
* configure: Regenerate.
* config.h.in: Regenerate.
* system.h (memmem): Declare if HAVE_DECL_MEMMEM is zero.
Richard Biener [Fri, 24 Mar 2023 09:19:55 +0000 (10:19 +0100)]
Remove Negative(gwarf-) from gdwarf
Prior to the removal of STABS support the gdwarf, gstabs, ... options
formed a cycle with their Negative(..) option attribute. But that
didn't actually have any effect since most of the options also
are Joined or JoinedOrMissing for which there's no pruning of options
and so once ran into the set_debug_level diagnostics reporting
conflicting debug formats.
The following removes the remains of that cycle, which is a
Negative option from gdwarf to gdwarf-. With RejectNegative
added the expected effect of -gdwarf-4 -gdwarf would be to
enable DWARF5 support (but this doesn't happen for some reason).
I think the more sensible behavior is that seen and implemented
in opts.cc, the more specific -gdwarf-4 determines the DWARF level
and a later or earlier -gdwarf becomes a no-op. So the
Negative(..) annotation on gdwarf is just confusing.
* common.opt (gdwarf): Remove Negative(gdwarf-).
Richard Biener [Fri, 24 Mar 2023 08:57:33 +0000 (09:57 +0100)]
Disallow -gno-dwarf, gno-dwarf-N, -gno-gdb and -gno-vms
The following adds RejectNegative to the gdwarf, gdwarf-, ggdb and gvms
options since the current behavior is to treat the negative variant
the same as the positive variant. In particular -ggdb -gno-gdb
do not cancel, and plain -gno-dwarf will enable (dwarf!) debug output.
Rejecting the negative forms avoids interpreting sensible behavior
to combinations of options like -gdwarf-5 -gno-dwarf-3 and sticks to
the behavior that later -g options simply override earlier ones and
the only negative form is -g0.
* common.opt (gdwarf): Add RejectNegative.
(gdwarf-): Likewise.
(ggdb): Likewise.
(gvms): Likewise.
Hans-Peter Nilsson [Tue, 28 Mar 2023 01:23:33 +0000 (03:23 +0200)]
CRIS: Correct "T" to define_memory_constraint, not define_constraint
This patch has no effect on builds using reload of libgcc, newlib libc, my
own at-a-glance-testsuite and coremark. That somewhat surprisingly
also goes for LRA builds, even with all CRIS reload_in_progress
augmented to include lra_in_progress. I just noticed it when checking
because another port had a similar fix, where it mattered for LRA.
* config/cris/constraints.md ("T"): Correct to
define_memory_constraint.
Hans-Peter Nilsson [Tue, 28 Mar 2023 01:21:13 +0000 (03:21 +0200)]
CRIS: Add peephole2 to handle gcc.target/cris/rld-legit1.c for LRA
The test-case gcc.target/cris/rld-legit1.c is a reduced
test-case that required defining LEGITIMIZE_RELOAD_ADDRESS
to stop the address from being decomposed into several insns
by reload. Valid but suboptimal code was generated.
(Before implementing that hook for CRIS, the same test-case
also exposed a bug in reload, and a fix was committed to
avoid an ICE; see e.g. git r0-71992-gff0d9879ab0f30 and
related commits. But, post-cc0, reload no longer handles
this test-case without LEGITIMIZE_RELOAD_ADDRESS helping and
there'd again an be ICE for CRIS (again: only if
LEGITIMIZE_RELOAD_ADDRESS is disabled). There's a patch to
reload to fix that, at
https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612039.html)
But, LRA also does not handle that test-case gracefully, and
like reload without LEGITIMIZE_RELOAD_ADDRESS for CRIS,
decomposes the address into a suboptimal (but valid)
sequence, about as messy as that from reload, and
gcc.target/cris/rld-legit1.c would regress for LRA. There's
nothing equivalent to LEGITIMIZE_RELOAD_ADDRESS for LRA.
(Stepping through LRA, I can't find an obvious place where
to put such a hook. Granted, I haven't seen this kind of
messy decomposition in other code, so I'm not insisting a
LEGITIMIZE_RELOAD_ADDRESS-like hook is a good idea.)
These new peephole2's are required to not regress
gcc.target/cris/rld-legit1.c with LRA enabled for CRIS.
They don't appear to otherwise make a difference for neither
libgcc, newlib libc, my own at-a-glance tests nor coremark,
for neither LRA nor reload.
* config/cris/cris.md (BW2): New mode-iterator.
(lra_szext_decomposed, lra_szext_decomposed_indirect_with_offset): New
peephole2s.
Hans-Peter Nilsson [Tue, 28 Mar 2023 01:20:05 +0000 (03:20 +0200)]
CRIS: Improve bailing for eliminable compares for "addi" vs. "add"
This patch affects a post-reload define_split for CRIS that transforms
a condition-code-clobbering addition into a non-clobbering addition.
(A "two-operand" addition between registers is the only insn that has
both a condition-code-clobbering and a non-clobbering variant for
CRIS.) Many more "add.d":s are replaced by non-condition-code-
clobbering "addi":s after this patch, but most of the transformations
don't matter.
CRIS with LRA generated code that exposed a flaw with the original
patch: it bailed too easily, on *any* insn using the result of the
addition. To wit, more effort than simply applying reg_mentioned_p is
needed to inspect the user, in the code to avoid munging an insn
sequence that cmpelim is supposed to handle.
With this patch coremark score for CRIS (*with reload*) improves by
less than 0.01% (a single "nop" is eliminated in
core_state_transition, in an execution path that affects ~1/20 of all
of the 10240 calls). However, the original cause for this patch is to
not regress gcc.target/cris/pr93372-44.c for LRA, where otherwise a
needless "cmpq" is emitted. For CRIS with LRA, the performance effect
on coremark isn't even measurable, except by reducing the size of the
executable due to affecting non-called library code.
* config/cris/cris.md ("*add<mode>3_addi"): Improve to bail only
for possible eliminable compares.
Hans-Peter Nilsson [Tue, 28 Mar 2023 01:18:31 +0000 (03:18 +0200)]
CRIS: Remove unused constraint "R".
* config/cris/constraints.md ("R"): Remove unused constraint.
GCC Administrator [Tue, 28 Mar 2023 00:17:14 +0000 (00:17 +0000)]
Daily bump.
Jonathan Wakely [Mon, 27 Mar 2023 12:46:46 +0000 (13:46 +0100)]
gcov: Fix "subcomand" typos [PR109297]
gcc/ChangeLog:
PR gcov-profile/109297
* gcov-tool.cc (merge_usage): Fix "subcomand" typo.
(merge_stream_usage): Likewise.
(overlap_usage): Likewise.
Richard Biener [Mon, 27 Mar 2023 12:30:47 +0000 (14:30 +0200)]
tree-optimization/54498 - testcase for the bug
I realized I never added a testcase for the fix of this bug. Now done
after verifying it still fails when reverting the fix.
PR tree-optimization/54498
* g++.dg/torture/pr54498.C: New testcase.
Richard Biener [Mon, 27 Mar 2023 12:22:56 +0000 (14:22 +0200)]
tree-optimization/108357 - add testcase
The following adds the testcase for the bug which was recently
fixed.
PR tree-optimization/108357
* gcc.dg/tree-ssa/pr108357.c: New testcase.
Christoph Müllner [Mon, 27 Mar 2023 10:51:51 +0000 (12:51 +0200)]
target/109296 - riscv: Add missing mode specifiers for XTheadMemPair
This patch adds missing mode specifiers for XTheadMemPair INSNs.
gcc/ChangeLog:
PR target/109296
* config/riscv/thead.md: Add missing mode specifiers.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Jakub Jelinek [Mon, 27 Mar 2023 10:02:06 +0000 (12:02 +0200)]
libstdc++: Fix up experimental/net/timer/waitable/dest.cc testcase
In Fedora package build I've noticed a failure
/builddir/build/BUILD/gcc-13.0.1-
20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc: In function 'void test01()':
/builddir/build/BUILD/gcc-13.0.1-
20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41: warning: format '%lu' expects argument of type 'long unsigned int', but a
rgument 2 has type 'unsigned int' [-Wformat=]
FAIL: experimental/net/timer/waitable/dest.cc (test for excess errors)
Excess errors:
/builddir/build/BUILD/gcc-13.0.1-
20230324/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc:41: warning: format '%lu' expects argument of type 'long unsigned int', but
+argument 2 has type 'unsigned int' [-Wformat=]
because we build with -Wformat.
The test uses %lu for size_t argument, which can be anything from unsigned
int to unsigned long long. As for printf I'm not sure we can use %zu
portably and given the n == 1 assertion, I think the options are to kill
the printf, or cast to long.
2023-03-27 Jakub Jelinek <jakub@redhat.com>
* testsuite/experimental/net/timer/waitable/dest.cc: Avoid -Wformat
warning if size_t is not unsigned long.
Philipp Tomsich [Mon, 27 Mar 2023 07:16:22 +0000 (09:16 +0200)]
aarch64: update ampere1 vectorization cost
The original submission of AmpereOne (-mcpu=ampere1) costs occurred
prior to exhaustive testing of vectorizable workloads against
hardware.
Adjust the vector costs to achieve the best results and more closely
match the underlying hardware.
gcc/ChangeLog:
* config/aarch64/aarch64.cc: Update vector costs for ampere1.
Co-Authored-By: Jiangning Liu <jiangning.liu@amperecomputing.com>
Co-Authored-By: Manolis Tsamis <manolis.tsamis@vrull.eu>
Martin Liska [Mon, 27 Mar 2023 08:03:26 +0000 (10:03 +0200)]
fix: pytest error
Fixes:
gcc/testsuite/lib/verify-sarif-file.py:10:27: Q000 Double quotes found but single quotes preferred
gcc/testsuite/ChangeLog:
* lib/verify-sarif-file.py: Use apostrophes instead
of double quotes.
Richard Biener [Wed, 22 Mar 2023 09:05:19 +0000 (10:05 +0100)]
rtl-optimization/109237 - speedup bb_is_just_return
For the testcase bb_is_just_return is on top of the profile, changing
it to walk BB insns backwards puts it off the profile. That's because
in the forward walk you have to process possibly many debug insns
but in a backward walk you very likely run into control insns first.
PR rtl-optimization/109237
* cfgcleanup.cc (bb_is_just_return): Walk insns backwards.
Richard Biener [Thu, 23 Mar 2023 15:56:53 +0000 (16:56 +0100)]
lto/109263 - lto-wrapper and -g0 -ggdb
The following makes lto-wrapper deal with non-combined debug
disabling / enabling option combinations properly. Interestingly
-gno-dwarf also enables debug.
PR lto/109263
* lto-wrapper.cc (run_gcc): Parse alternate debug options
as well, they always enable debug.
Kewen Lin [Mon, 27 Mar 2023 02:43:39 +0000 (21:43 -0500)]
rs6000: Make _mm_slli_si128 and _mm_bslli_si128 consistent [PR109167]
As PR109167 shows, it's unexpected to have two different
implementation ways for _mm_slli_si128 and _mm_bslli_si128,
as gcc/config/i386/emmintrin.h they should be the same. So
this patch is to fix it accordingly.
PR target/109167
gcc/ChangeLog:
* config/rs6000/emmintrin.h (_mm_bslli_si128): Move the implementation
from ...
(_mm_slli_si128): ... here. Change to call _mm_bslli_si128 directly.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr109167.c: New test.
Kewen Lin [Mon, 27 Mar 2023 02:42:23 +0000 (21:42 -0500)]
rs6000: Ensure vec_sld shift count in allowable range [PR109082]
As PR109082 shows, some uses of vec_sld in emmintrin.h don't
strictly guarantee the given shift count is in the range
0-15 (inclusive). This patch is to make the argument
range constraint honored for those uses.
PR target/109082
gcc/ChangeLog:
* config/rs6000/emmintrin.h (_mm_bslli_si128): Check __N is not less
than zero when calling vec_sld.
(_mm_bsrli_si128): Return __A if __N is zero, check __N is bigger than
zero when calling vec_sld.
(_mm_slli_si128): Return __A if _imm5 is zero, check _imm5 is bigger
than zero when calling vec_sld.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr109082.c: New test.
Sandra Loosemore [Tue, 21 Mar 2023 22:15:33 +0000 (22:15 +0000)]
Docs, OpenMP: Correct internal documentation of OMP_FOR.
gcc/ChangeLog:
* doc/generic.texi (OpenMP): Document OMP_SIMD, OMP_DISTRIBUTE,
OMP_TASKLOOP, and OMP_LOOP with OMP_FOR. Document how collapsed
loops are represented and which fields are vectors. Add
documentation for OMP_FOR_PRE_BODY field. Document internal
form of non-rectangular loops and OMP_FOR_NON_RECTANGULAR.
* tree.def (OMP_FOR): Make documentation consistent with the
Texinfo manual, to fill some gaps and correct errors.
GCC Administrator [Mon, 27 Mar 2023 00:16:43 +0000 (00:16 +0000)]
Daily bump.
Andreas Schwab [Sun, 17 Jul 2022 21:35:05 +0000 (23:35 +0200)]
m68k: handle TLS access with offset
This reinstates FINAL_PRESCAN_INSN, and the calls in handle_move_double,
so that access to TLS variables with offset are properly handled.
gcc:
PR target/106282
* config/m68k/m68k.h (FINAL_PRESCAN_INSN): Define.
* config/m68k/m68k.cc (m68k_final_prescan_insn): Define.
(handle_move_double): Call it before handle_movsi.
* config/m68k/m68k-protos.h: Declare it.
gcc/testsuite:
PR target/106282
* gcc.target/m68k/tls-gd-off.c: New.
* gcc.target/m68k/tls-ie-off.c: New.
* gcc.target/m68k/tls-ld-off.c: New.
* gcc.target/m68k/tls-ld-xtls-off.c: New.
* gcc.target/m68k/tls-le-off.c: New.
* gcc.target/m68k/tls-le-xtls-off.c: New.
* gcc.target/m68k/tls-ld.c: Make pattern less strict.
* gcc.target/m68k/tls-le.c: Likewise.
Jakub Jelinek [Sun, 26 Mar 2023 18:17:00 +0000 (20:17 +0200)]
match.pd: Fix up fneg/fadd simplification [PR109230]
The following testcase is miscompiled on aarch64-linux. match.pd
has a simplification for addsub, where it negates one of the vectors
in twice as large floating point element vector (effectively negating every
other element) and then doing addition.
But a requirement for that is that the permutation picks the right elements,
in particular 0, nelts+1, 2, nelts+3, 4, nelts+5, ...
The pattern tests this with sel.series_p (0, 2, 0, 2) check, which as
documented verifies that the even elements of the permutation mask are
identity, but doesn't say anything about the others.
The following patch fixes it by also checking that the odd elements
start at nelts + 1 with the same step of 2.
2023-03-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/109230
* match.pd (fneg/fadd simplify): Verify also odd permutation indexes.
* gcc.dg/pr109230.c: New test.
Jakub Jelinek [Sun, 26 Mar 2023 18:15:05 +0000 (20:15 +0200)]
predict: Don't emit -Wsuggest-attribute=cold warning for functions which already have that attribute [PR105685]
In the following testcase, we predict baz to have cold
entry regardless of the user supplied attribute (as it call
unconditionally a cold function), but still issue
a -Wsuggest-attribute=cold warning despite it having that attribute
already.
The following patch avoids that.
2023-03-26 Jakub Jelinek <jakub@redhat.com>
PR ipa/105685
* predict.cc (compute_function_frequency): Don't call
warn_function_cold if function already has cold attribute.
* c-c++-common/cold-2.c: New test.
Gerald Pfeifer [Sun, 26 Mar 2023 10:21:31 +0000 (12:21 +0200)]
doc: Remove anachronistic note related to languages built
This is another instance of what
ce51e8439a49 (and originally
05432288d4e5) addressed in a different part. We stopped shipping
granular tarballs years ago.
gcc/ChangeLog:
* doc/install.texi: Remove anachronistic note
related to languages built and separate source tarballs.
GCC Administrator [Sun, 26 Mar 2023 00:16:45 +0000 (00:16 +0000)]
Daily bump.