The PR97330 fix caused some missed sinking of loads out of loops
the following patch re-instantiates.
2022-05-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/105618
* tree-ssa-sink.cc (statement_sink_location): For virtual
PHI uses ignore those defining the used virtual operand.
* gcc.dg/tree-ssa/ssa-sink-19.c: New testcase.
(cherry picked from commit ebce0e9bd8)
2022-05-16 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105577
* g++.dg/torture/pr105577.C: New testcase.
(cherry picked from commit ef7b8976b9)
When one of the first two stages of DSE removes a throwing stmt
we have to purge dead EH edges before the DF re-analyze fires off
a fast DCE since that cannot cope with the situation.
2022-05-12 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105577
* dse.cc (rest_of_handle_dse): Make sure to purge dead EH
edges before running fast DCE via df_analyze.
(cherry picked from commit dfda40f814)
We can avoid some uninit diagnostics by making FRE disambiguate
against CLOBBERs since any aliasing there would invoke undefined
behavior for a read we are looking up.
2022-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/105562
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Disambiguate
against all CLOBBER defs if there's not an obvious must-alias
and we are not doing redundant store elimination.
(vn_walk_cb_data::redundant_store_removal_p): New field.
(vn_reference_lookup_pieces): Initialize it.
(vn_reference_lookup): Add argument to specify if we are
doing redundant store removal.
(eliminate_dom_walker::eliminate_stmt): Specify we do.
* tree-ssa-sccvn.h (vn_reference_lookup): Adjust.
* g++.dg/warn/uninit-pr105562.C: New testcase.
(cherry picked from commit 94b8a37fa1)
When the insn to delete is a debug insn there's no point in figuring
out whether it might be the last real insn and thus we have to purge
dead edges.
2022-05-11 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105559
* cfgrtl.cc (delete_insn_and_edges): Only perform search to BB_END
for non-debug insns.
(cherry picked from commit 37a8220fa9)
The following makes sure to have a consistent state of
flag_var_tracking_assignments with the distributed handling
in process_options and finish_options by moving everything to
finish_options which also restores diagnostics for
-g0 -fvar-tracking which was lost with previous changes.
2022-05-10 Richard Biener <rguenther@suse.de>
PR middle-end/105537
* toplev.cc (process_options): Move flag_var_tracking
handling ...
* opts.cc (finish_options): ... here.
* gcc.dg/torture/pr105537.c: New testcase.
(cherry picked from commit 76db543db8)
When code was moved from process_options to finish_options it
was not properly adjusted to look at and alter the opts set
passed to the function but continued to modify the global options
set. The following rectifies this and makes sure the same
mistake isn't repeated by poisoning global_options{,_set}.
2022-05-10 Richard Biener <rguenther@suse.de>
* flags.h (dwarf_debuginfo_p): Add opts argument, guard
API with !GENERATOR_FILE.
* opts.cc (global_options): Poison.
(global_options_set): Likewise.
(finish_options): Refer to options via opts.
(cherry picked from commit d469484610)
This avoids undefined signed overflow when calling powi_as_mults_1.
2022-04-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/105431
* tree-ssa-math-opts.cc (powi_as_mults_1): Make n unsigned.
(powi_as_mults): Use absu_hwi.
(gimple_expand_builtin_powi): Remove now pointless n != -n
check.
(cherry picked from commit 44b09adb9b)
The problem is that subtypes are not part of the limited view of a package
so we need to use types in conjunction with limited_with clauses, which is
not always desirable as this yields less portable Ada bindings. The patch
also contains a small enhancement for complex floating-point types.
gcc/c-family/
* c-ada-spec.cc (dump_ada_node) <COMPLEX_TYPE>: Deal with usual
floating-point complex types.
<POINTER_TYPE>: Do not use limited_with clause if the designated
type is a scalar type.
When registering a relation, we need to merge with any existing relation
before checking if it was an equivalence... otherwise it was not being
handled properly.
gcc/
PR tree-optimization/105458
* value-relation.cc (path_oracle::register_relation): Merge, then check
for equivalence.
gcc/testsuite/
* gcc.dg/pr105458.c: New.
OpenMP 5.2 added
"When called from within a target region the effect is unspecified."
restriction to omp_display_env, so it is ok not to support it in
target regions (worst case we could add an empty implementation
or one with __builtin_trap in there).
2022-05-17 Jakub Jelinek <jakub@redhat.com>
* libgomp.texi (OpenMP 5.1): Remove "Not inside target regions"
comment for omp_display_env feature.
(cherry picked from commit 741478ed3e)
These are the C++23 proposals supported in the gcc-12 branch.
libstdc++-v3/ChangeLog:
* doc/xml/manual/status_cxx2023.xml: Update with gcc-12 support.
* doc/html/*: Regenerate.
(cherry picked from commit 8414dad54a)
These are the C++23 proposals already supported in the gcc-11 branch.
libstdc++-v3/ChangeLog:
* doc/xml/manual/intro.xml: Include new chapter.
* doc/xml/manual/status_cxx2020.xml: Tweak release numbers.
* doc/xml/manual/status_cxx2023.xml: New file.
* doc/html/*: Regenerate.
(cherry picked from commit 4361867344)
libstdc++-v3/ChangeLog:
* doc/html/manual/status.html: Regenerate.
* doc/xml/manual/status_cxx2020.xml: Fix supported version for
C++20 bit operations.
(cherry picked from commit 64648821f1)
DW_OP_not is a bitwise, not a logical NOT, so it computes the wrong result
in a DWARF conditional expression.
gcc/
* dwarf2out.cc (loc_list_from_tree_1) <TRUTH_NOT_EXPR>: Do a logical
instead of a bitwise negation.
<COND_EXPR>: Swap the operands if the condition is TRUTH_NOT_EXPR.
D front-end changes:
- Import dmd v2.100.0.
Phobos changes:
- Import phobos v2.100.0.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd a53934d18.
* dmd/VERSION: Update version to v2.100.0.
* d-codegen.cc (d_decl_context): Use resolvedLinkage to get
declaration linkage.
(build_struct_literal): Track offset in bits.
* d-gimplify.cc (d_gimplify_modify_expr): Check both operands for a
bit-field reference.
* d-lang.cc (d_post_options): Set flag_rtti and flag_exceptions if
-fno-druntime was seen on command-line.
(d_type_promotes_to): Use resolvedLinkage to get declaration linkage.
* decl.cc (make_thunk): Likewise.
* types.cc (layout_aggregate_members): Ignore anonymous fields in
total count.
libphobos/ChangeLog:
* src/MERGE: Merge upstream phobos 604534d7c.
My patch for 105191 made us use build_value_init more frequently from
build_vec_init_expr, but build_value_init doesn't like to be called to
initialize a class in a template. That's caused trouble in the past, and
seems like a strange restriction, so let's fix it.
PR c++/105589
PR c++/105191
PR c++/92385
gcc/cp/ChangeLog:
* init.cc (build_value_init): Handle class in template.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist-array16.C: New test.
In this testcase, we were trying to substitute into
variant<Foo<T>>::__accepted_type, but failed to look it up because
variant<Foo<T>> doesn't exist. In other cases we already rewrite such
things into a dependent reference; we need to do that for alias templates as
well.
This caused some testsuite regressions on alias uses outside of deduction
guides, so I've made all of this rewriting conditional on a new tf_dguide
tsubst flag.
PR c++/104470
gcc/cp/ChangeLog:
* cp-tree.h (enum tsubst_flags): Add tf_dguide.
* pt.cc (tsubst_aggr_type): Check it.
(tsubst_baselink, tsubst_copy): Check it.
(maybe_dependent_member_ref): Check it.
(instantiate_alias_template): Handle it.
(build_deduction_guide): Set it.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/explicit11.C: Second example also ill-formed.
* g++.dg/cpp2a/class-deduction-alias12.C: New test.
PR49387 was a problem with initially asking for a typeid for a class
template specialization before it was complete, and later actually filling
in the descriptor when the class was complete, and thus disagreeing on the
form of the descriptor. I fixed that by forcing the class to be complete,
but this testcase shows why that approach is problematic. So instead let's
adjust the type of the descriptor later if needed.
PR c++/102651
PR c++/49387
gcc/cp/ChangeLog:
* rtti.cc (get_tinfo_decl_direct): Don't complete_type.
(emit_tinfo_decl): Update tdesc type if needed.
gcc/testsuite/ChangeLog:
* g++.dg/rtti/typeid-complete1.C: New test.
gcov_info::n_functions type is initialized by generated
code in build_info_type:
/* n_functions */
field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
get_gcov_unsigned_t ());
It uses gcov_unsigned_t, but the struct definition in libgcov.h uses
unsigned type. That brings troubled on 16-bit targets.
PR gcov-profile/105535
libgcc/ChangeLog:
* libgcov.h (struct gcov_info): Use gcov_unsigned_t for
n_functions.
Co-Authored-By: Hans-Peter Helfert <peter-helfert@t-online.de>
(cherry picked from commit eaf359ed04e7169f740dade548965c757f4c1e0a)
Most cases of VIEW_CONVERT_EXPRs involving reverse scalar storage order are
disqualified for SRA because they are storage_order_barrier_p, but you can
still have a VIEW_CONVERT_EXPR to a regular composite type being applied to
a component of a record type with reverse scalar storage order.
In this case the bypass for !useless_type_conversion_p in sra_modify_assign,
albeit already heavily guarded, triggers and may generate wrong code, so the
patch makes sure that it does only when the SSO is the same on both side.
gcc/
* tree-sra.cc (sra_modify_assign): Check that scalar storage order
is the same on the LHS and RHS before rewriting one with the model
of the other.
gcc/testsuite/
* gnat.dg/sso17.adb: New test.
When turning unconditional edges into conditional, as in
gimple-harden-conditionals.cc:insert_check_and_trap, the newly-created
edge's probability comes out uninitialized, while the previously
unconditional edge's probability is presumably
profile_probability::always.
Mixing initialized and uninitialized probabilities before expand
breaks predict.cc:force_edge_cold: the initialized probability may end
up copied to a REG_BR_PROB note in a conditional branch insn, but if
force_edge_cold is called on that edge, it will find another edge with
uninitialized probability and assume the note is absent. Later on,
rtl_verify_edges complains that the note does not match the
probability modified by force_edge_cold in the edge.
This patch sets probabilities for edges affected by hardening of
conditionals, both the newly-created edges to trap blocks and the
previously-unconditional edges, so that the former are considered
never taken, while the latter are confirmed as always taken.
for gcc/ChangeLog
PR rtl-optimization/105455
* gimple-harden-conditionals.cc (insert_check_and_trap): Set
probabilities for newly-conditional edges.
for gcc/testsuite/ChangeLog
PR rtl-optimization/105455
* gcc.dg/pr105455.c: New.
(cherry picked from commit 90a8eab4a1)
libstdc++'s bits/simd.h section for PowerPC, guarded by __ALTIVEC__,
defines various intrinsic vector types that are only available with
__VSX__: 64-bit long double, double, (un)signed long long, and 64-bit
(un)signed long.
experimental/simd/standard_abi_usable{,_2}.cc tests error out
reporting the unmet requirements when the target cpu doesn't enable
VSX. Make the reported instrinsic types conditional on __VSX__ so
that <experimental/simd> can be used on PowerPC variants that do not
support VSX.
for libstdc++-v3/ChangeLog
* include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX
for double, long long, and 64-bit long intrinsic types.
[__ALTIVEC__] (__intrinsic_type): Mention 128-bit in
preexisting long double diagnostic, adjust no-VSX double
diagnostic to cover 64-bit long double as well.
(cherry picked from commit 469c76f0d9)
In the PR, the verifier complains that we did not manage to remove the
body of a node and it is right. The node is kept for materialization
of two clones but after one is materialized, the other one is removed
as unneeded (as a part of delete_unreachable_blocks_update_callgraph).
The problem is that the node removal does not check for this situation
and can leave the clone_of node there with a body attached to it even
though there is no use for it any more. This patch does checks for it
and handles the situation in a simlar way that
cgraph_node::materialize_clone does it, except that it also has to be
careful that the removed node itself does not have any clones, which
would still need the clone_of's body. Failing to do that results in a
bootstrap failure.
gcc/ChangeLog:
2022-04-27 Martin Jambor <mjambor@suse.cz>
PR ipa/100413
* cgraph.cc (cgraph_node::remove): Release body of the node this
is clone_of if appropriate.
gcc/testsuite/ChangeLog:
2022-04-27 Martin Jambor <mjambor@suse.cz>
PR ipa/100413
* g++.dg/ipa/pr100413.C: New test.
(cherry picked from commit 27ee75dbe8)
Add .note.GNU-stack section only for Linux since it may not be supported
on non-Linux OSes. __ELF__ isn't checked since these tests can only run
on Linux/x86 ELF systems.
PR target/105472
* gcc.target/i386/iamcu/asm-support.S: Add .note.GNU-stack section
only for Linux.
* gcc.target/x86_64/abi/asm-support.S: Likewise.
* gcc.target/x86_64/abi/avx/asm-support.S: Likewise.
* gcc.target/x86_64/abi/avx512f/asm-support.S: Likewise.
* gcc.target/x86_64/abi/avx512fp16/asm-support.S: Likewise.
* gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S: Likewise.
* gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S: Likewise.
* gcc.target/x86_64/abi/ms-sysv/do-test.S: Likewise.
(cherry picked from commit 71eae0fd3d)
The following testcase ICEs (and only without -g), because we don't replace
one VEC_COND_EXPR with .VCOND* call.
We don't do that because gimple_expand_vec_set_expr adds some stmts before
*gsi and then uses gsi_remove to remove it. gsi_remove moves the iterator
to the next stmt and in the caller we then do gsi_next before looking at
another stmt, which means we can skip processing of one stmt, which in this
case happened to be a VEC_COND_EXPR but with -g is some debug stmt in
between. As we always emit some stmts before it, it is easy to update the
iterator to the last stmt emitted there, so that caller continues really
with the next stmt.
2022-05-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/105528
* gimple-isel.cc (gimple_expand_vec_set_expr): After gsi_remove
set *gsi to gsi_for_stmt (ass_stmt). Fix up function comment.
* gcc.dg/pr105528.c: New test.
(cherry picked from commit ddd46293e2)
This is a regression present since the 10.x series, but the underlying issue
has been there since the TARGET_VEC_PERM_CONST hook was implemented, in the
form of an ICE when expanding a constant VEC_PERM_EXPR in V4QI, while the
back-end only supports V8QI constant VEC_PERM_EXPRs.
gcc/
PR target/105292
* config/sparc/sparc.cc (sparc_vectorize_vec_perm_const): Return
true only for 8-byte vector modes.
gcc/testsuite/
* gcc.target/sparc/20220510-1.c: New test.
On Solaris the dirent::d_name member is a single char, causing this test
to fail with warnings about buffer overflow. Change the test to use a
union with additional space for writing a string to the d_name member.
libstdc++-v3/ChangeLog:
PR libstdc++/104731
* testsuite/27_io/filesystem/iterators/error_reporting.cc:
Use a trailing char array as storage for dirent::d_name.
(cherry picked from commit aa8bdfee1d)
This fixes a regression in std::normal_distribution deserialization that
caused the object to be left unchanged if the __state_avail value read
from the stream was false.
libstdc++-v3/ChangeLog:
PR libstdc++/105502
* include/bits/random.tcc
(operator>>(basic_istream<C,T>&, normal_distribution<R>&)):
Update state when __state_avail is false.
* testsuite/26_numerics/random/normal_distribution/operators/serialize.cc:
Check that deserialized object equals serialized one.
(cherry picked from commit 909ef4e272)