Commit graph

181013 commits

Author SHA1 Message Date
GCC Administrator
2bee28dd41 Daily bump. 2020-11-10 00:16:24 +00:00
Marek Polacek
04126e46eb c++: DR 1914 - Allow duplicate standard attributes.
Following Joseph's change for C to allow duplicate C2x standard attributes
<https://gcc.gnu.org/pipermail/gcc-patches/2020-October/557272.html>,
this patch does a similar thing for C++.  This is DR 1914, to be resolved by
<wg21.link/p2156>, which is not part of the standard yet, but has wide
support so looks like a shoo-in.  The duplications now produce warnings
instead, but only if the attribute wasn't specified via a macro.

gcc/c-family/ChangeLog:

	DR 1914
	* c-common.c (attribute_fallthrough_p): Tweak the warning
	message.

gcc/cp/ChangeLog:

	DR 1914
	* parser.c (cp_parser_check_std_attribute): Return bool.  Add a
	location_t parameter.  Return true if the attribute wasn't duplicated.
	Give a warning instead of an error.  Check more attributes.
	(cp_parser_std_attribute_list): Don't add duplicated attributes to
	the list.  Pass location to cp_parser_check_std_attribute.

gcc/testsuite/ChangeLog:

	DR 1914
	* c-c++-common/attr-fallthrough-2.c: Adjust dg-warning.
	* g++.dg/cpp0x/fallthrough2.C: Likewise.
	* g++.dg/cpp0x/gen-attrs-60.C: Turn dg-error into dg-warning.
	* g++.dg/cpp1y/attr-deprecated-2.C: Likewise.
	* g++.dg/cpp2a/attr-likely2.C: Adjust dg-warning.
	* g++.dg/cpp2a/nodiscard-once.C: Turn dg-error into dg-warning.
	* g++.dg/cpp0x/gen-attrs-72.C: New test.
2020-11-09 18:22:58 -05:00
Patrick Palka
d3fd75d869 c++: Consider only relevant template arguments in sat_hasher
A large source of cache misses in satisfy_atom is caused by the identity
of an (atom,args) pair within the satisfaction cache being determined by
the entire set of supplied template arguments rather than by the subset
of template arguments that the atom actually depends on.  For instance,
consider

  template <class T> concept range = range_v<T>;
  template <class U> void foo () requires range<U>;
  template <class U, class V> void bar () requires range<U>;

The associated constraints of foo and bar are equivalent: they both
consist of the atom range_v<T> (with mapping T -> U).  But the sat_cache
currently will never reuse a satisfaction value between the two atoms
because foo has one template parameter and bar has two, and the
satisfaction cache conservatively assumes that all template parameters
of the constrained decl are relevant to a satisfaction value of one of
its atoms.

This patch eliminates this assumption and makes the sat_cache instead
care about just the subset of args of an (atom,args) pair that is
relevant to satisfaction.

This patch additionally fixes a seemingly latent bug that was found when
testing against range-v3.  In the testcase concepts-decltype2.C below,
during normalization of f's constraints we end up forming a TARGET_EXPR
whose _SLOT has a DECL_CONTEXT that points to g instead of f because
current_function_decl is not updated before we start normalizing.
This patch fixes this accordingly, and also adds a sanity check to
keep_template_parm to verify each found parameter has a valid index.

With this patch, compile time and memory usage for the cmcstl2 test
test/algorithm/set_symmetric_difference4.cpp drops from 8.5s/1.2GB to
3.5s/0.4GB.

gcc/cp/ChangeLog:

	* constraint.cc (norm_info::norm_info): Initialize orig_decl.
	(norm_info::orig_decl): New data member.
	(normalize_atom): When caching an atom for the first time,
	compute a list of template parameters used in the targets of the
	parameter mapping and store it in the TREE_TYPE of the mapping.
	(get_normalized_constraints_from_decl): Set current_function_decl
	appropriately when normalizing.  As an optimization, don't
	set up a push_nested_class_guard when decl has no constraints.
	(sat_hasher::hash): Use this list to hash only the template
	arguments that are relevant to the atom.
	(satisfy_atom): Use this list to compare only the template
	arguments that are relevant to the atom.
	* pt.c (keep_template_parm): Do a sanity check on the parameter's
	index when flag_checking.
2020-11-09 18:16:48 -05:00
Patrick Palka
3d56e969cb c++: Use two levels of caching in satisfy_atom
This improves the effectiveness of caching in satisfy_atom by querying
the cache again after we've instantiated the atom's parameter mapping.

Before instantiating its mapping, the identity of an (atom,args) pair
within the satisfaction cache is determined by idiosyncratic things like
the level and index of each template parameter used in targets of the
parameter mapping.  For example, the associated constraints of foo in

  template <class T> concept range = range_v<T>;
  template <class U, class V> void foo () requires range<U> && range<V>;

are range_v<T> (with mapping T -> U) /\ range_v<T> (with mapping T -> V).
If during satisfaction the template arguments supplied for U and V are
the same, then the satisfaction value of these two atoms will be the
same (despite their uninstantiated parameter mappings being different).

But sat_cache doesn't see this because it compares the uninstantiated
parameter mapping and the supplied template arguments of sat_entry's
independently.  So satisy_atom on this latter atom will end up fully
evaluating it instead of reusing the satisfaction value of the former.

But there is a point when the two atoms do look the same to sat_cache,
and that's after instantiating their parameter mappings.  By querying
the cache again at this point, we can avoid substituting the same
instantiated parameter mapping into the same expression a second time
around.

With this patch, compile time and memory usage for the cmcstl2 test
test/algorithm/set_symmetric_diference4.cpp drops from 11s/1.4GB to
8.5s/1.2GB with an --enable-checking=release compiler.

gcc/cp/ChangeLog:

	* cp-tree.h (ATOMIC_CONSTR_MAP_INSTANTIATED_P): Define this flag
	for ATOMIC_CONSTRs.
	* constraint.cc (sat_hasher::hash): Use hash_atomic_constraint
	if the flag is set, otherwise keep using a pointer hash.
	(sat_hasher::equal): Return false if the flag's setting differs
	on two atoms.  Call atomic_constraints_identical_p if the flag
	is set, otherwise keep using a pointer equality test.
	(satisfy_atom): After instantiating the parameter mapping, form
	another ATOMIC_CONSTR using the instantiated mapping and query
	the cache again.  Cache the satisfaction value of both atoms.
	(diagnose_atomic_constraint): Simplify now that the supplied
	atom has an instantiated mapping.
2020-11-09 18:12:49 -05:00
Patrick Palka
2096ebd393 c++: Reuse identical ATOMIC_CONSTRs during normalization
Profiling revealed that sat_hasher::equal accounts for nearly 40% of
compile time in some cmcstl2 tests.

This patch eliminates this bottleneck by caching the ATOMIC_CONSTRs
returned by normalize_atom.  This in turn allows us to replace the
expensive atomic_constraints_identical_p check in sat_hasher::equal
with cheap pointer equality, with no loss in cache hit rate.

With this patch, compile time for the cmcstl2 test
test/algorithm/set_symmetric_difference4.cpp drops from 19s to 11s with
an --enable-checking=release compiler.

gcc/cp/ChangeLog:

	* constraint.cc (atom_cache): Define this deletable hash_table.
	(normalize_atom): Use it to cache ATOMIC_CONSTRs when not
	generating diagnostics.
	(sat_hasher::hash): Use htab_hash_pointer instead of
	hash_atomic_constraint.
	(sat_hasher::equal): Test for pointer equality instead of
	atomic_constraints_identical_p.
	* cp-tree.h (struct atom_hasher): Moved and renamed from ...
	* logic.cc (struct constraint_hash): ... here.
	(clause::m_set): Adjust accordingly.
2020-11-09 18:12:47 -05:00
Patrick Palka
71a8040716 c++: Fix ICE with variadic concepts and aliases [PR93907]
This patch (naively) extends the PR93907 fix to also apply to variadic
concepts invoked with a type argument pack.  Without this, we ICE on
the below testcase (a variadic version of concepts-using2.C) in the same
manner as we used to on concepts-using2.C before r10-7133.

gcc/cp/ChangeLog:

	PR c++/93907
	* constraint.cc (tsubst_parameter_mapping): Also canonicalize
	the type arguments of a TYPE_ARGUMENT_PACk.

gcc/testsuite/ChangeLog:

	PR c++/93907
	* g++.dg/cpp2a/concepts-using3.C: New test, based off of
	concepts-using2.C.
2020-11-09 18:12:42 -05:00
Pat Bernardi
32ff3309ae MAINTAINERS: Add myself for write after approval
2020-11-09  Pat Bernardi  <bernardi@adacore.com>

	* MAINTAINERS (Write After Approval): Add myself.
2020-11-09 16:03:16 -05:00
François Dumont
6db082477a libstdc++: Remove <debug/array>
Add _GLIBCXX_ASSERTIONS assert in normal std::array and remove __gnu_debug::array
implementation.

libstdc++-v3/ChangeLog:

	* include/debug/array: Remove.
	* include/Makefile.am: Remove <debug/array>.
	* include/Makefile.in: Regenerate.
	* include/experimental/functional: Adapt.
	* include/std/array: Move to _GLIBCXX_INLINE_VERSION namespace.
	* include/std/functional: Adapt.
	* include/std/span: Adapt.
	* testsuite/23_containers/array/debug/back1_neg.cc:
	Remove dg-require-debug-mode. Add -D_GLIBCXX_ASSERTIONS option.
	* testsuite/23_containers/array/debug/back2_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/front1_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/front2_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc:
	Likewise.
	* testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc:
	Likewise.
	* testsuite/23_containers/array/element_access/60497.cc
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
	Remove.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc
	* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
2020-11-09 21:20:01 +01:00
Jason Merrill
83f1c165d2 c++: Call tsubst_pack_expansion from tsubst.
This was unnecessary (and incomplete) code duplication.

gcc/cp/ChangeLog:

	* pt.c (tsubst): Replace *_ARGUMENT_PACK code with
	a call to tsubst_argument_pack.
2020-11-09 15:16:39 -05:00
Jason Merrill
05b03452db c++: Improve error location for class using-decl.
We should use the location of the using-declaration, not the location of the
class.

gcc/cp/ChangeLog:

	* class.c (handle_using_decl): Add an iloc_sentinel.

gcc/testsuite/ChangeLog:

	* g++.dg/lookup/using26.C: Adjust location.
	* g++.old-deja/g++.other/using1.C: Adjust location.
2020-11-09 15:16:38 -05:00
François Dumont
38b17c27ce libstdc++: Make _GLIBCXX_DEBUG checks constexpr compatible
libstdc++-v3/ChangeLog:

	* include/debug/assertions.h (__glibcxx_requires_non_empty_range):
	Remove __builtin_expect.
	(__glibcxx_requires_subscript): Likewise.
	(__glibcxx_requires_nonempty): Likewise.
	* include/debug/formatter.h (__check_singular): Add C++11 constexpr
	qualification.
	* include/debug/helper_functions.h (__check_singular): Likewise. Skip
	check if constant evaluated.
	(__valid_range): Do not skip check if constant evaluated.
	* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_COND_AT): Add
	__builtin_expect.
	(_GLIBCXX_DEBUG_VERIFY_AT_F): Use __glibcxx_assert_1.
	* testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc:
	New test.
	* testsuite/21_strings/basic_string_view/element_access/char/constexpr.cc: New test.
	* testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: New test.
	* testsuite/21_strings/basic_string_view/element_access/char/front_back_constexpr.cc:
	New test.
	* testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc:
	New test.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc:
	New test.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr.cc: New test.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: New test.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc:
	New test.
	* testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc: New test.
	* testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc: New test.
	* testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc: New test.
	* testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc: New test.
	* testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc: New test.
	* testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc: New test.
	* testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc: New test.
	* testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc: New test.
	* testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc: New test.
	* testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc: New test.
2020-11-09 21:11:13 +01:00
Marek Polacek
3a5f8d745f c++: Fix -Wvexing-parse ICE with omitted int [PR97762]
For declarations like

  long f();

decl_specifiers->type will be NULL, but I neglected to handle this case,
therefore we ICE.  So handle this case by pretending we've seen 'int',
which is good enough for -Wvexing-parse's purposes.

gcc/cp/ChangeLog:

	PR c++/97762
	* parser.c (warn_about_ambiguous_parse): Handle the case when
	there is no type in the decl-specifiers.

gcc/testsuite/ChangeLog:

	PR c++/97762
	* g++.dg/warn/Wvexing-parse8.C: New test.
2020-11-09 14:39:36 -05:00
Patrick Palka
6624075e7e c-family: Avoid unnecessary work when -Wpragmas is being ignored
This speeds up handle_pragma_diagnostic by avoiding computing a spelling
suggestion for an unrecognized option inside a #pragma directive when
-Wpragmas warnings are being suppressed.

In the range-v3 library, which contains many instances of

  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wpragmas"
  #pragma GCC diagnostic ignored "-Wfoo"
  ...
  #pragma GCC diagnostic pop

(where -Wfoo stands for a warning option we don't recognize), this
reduces compile time by 33% for some of its tests.

gcc/c-family/ChangeLog:

	* c-pragma.c (handle_pragma_diagnostic): Split the
	unknown-option -Wpragmas diagnostic into a warning and a
	subsequent note containing a spelling suggestion.  Avoid
	computing the suggestion if -Wpragmas warnings are being
	suppressed.

gcc/testsuite/ChangeLog:

	* gcc.dg/pragma-diag-6.c: Adjust expected diagnostics
	accordingly.
2020-11-09 11:14:00 -05:00
Patrick Palka
4394b1ce77 c-family: Fix regression in location-overflow-test-1.c [PR97117]
The r11-3266 patch that added macro support to -Wmisleading-indentation
accidentally suppressed the column-tracking diagnostic in
get_visual_column in some cases, e.g. in the location-overflow-test-1.c
testcase.

More generally, when all three tokens are on the same line and we've run
out of locations with column info, then their location_t values will be
equal, and we exit early from should_warn_for_misleading_indentation due
to the new check

  /* Give up if the loci are not all distinct.  */
  if (guard_loc == body_loc || body_loc == next_stmt_loc)
    return false;

before we ever call get_visual_column.

[ This new check is needed to detect and give up on analyzing code
  fragments where exactly two out of the three tokens come from the same
  macro expansion, e.g.

    #define MACRO \
      if (a)      \
        foo ();

    MACRO; bar ();

  Here, guard_loc and body_loc will be equal and point to the macro
  expansion point (and next_stmt_loc will point to 'bar').  The heuristics
  that the warning uses are not really valid in scenarios like these.  ]

In order to restore the column-tracking diagnostic, this patch moves the
the diagnostic code out from get_visual_column to earlier in
should_warn_for_misleading_indentation.  Moreover, it tests the three
locations for a zero column all at once, which I suppose should make us
issue the diagnostic more consistently.

gcc/c-family/ChangeLog:

	PR testsuite/97117
	* c-indentation.c (get_visual_column): Remove location_t
	parameter.  Move the column-tracking diagnostic code from here
	to ...
	(should_warn_for_misleading_indentation): ... here, before the
	early exit for when the loci are not all distinct.  Don't pass a
	location_t argument to get_visual_column.
	(assert_get_visual_column_succeeds): Don't pass a location_t
	argument to get_visual_column.
	(assert_get_visual_column_fails): Likewise.
2020-11-09 11:09:42 -05:00
Claudiu Zissulescu
c5395d88df arc: Improve/add instruction patterns to better use MAC instructions.
ARC MYP7+ instructions adds MAC instructions for either vector and
scalar data types. This patch adds a madd pattern for 16it datum using
the 32bit MAC instruction, and dot_prod patterns for v4hi vector
types. The 64bit moves are also upgraded by using vadd2 instuction.

2020-11-09  Claudiu Zissulescu  <claziss@synopsys.com>

gcc/

	* config/arc/arc.c (arc_split_move): Recognize vadd2 instructions.
	* config/arc/arc.md (movdi_insn): Update pattern to use vadd2
	instructions.
	(movdf_insn): Likewise.
	(maddhisi4): New pattern.
	(umaddhisi4): Likewise.
	* config/arc/simdext.md (mov<mode>_int): Update pattern to use
	vadd2.
	(sdot_prodv4hi): New pattern.
	(udot_prodv4hi): Likewise.
	(arc_vec_<V_US>mac_hi_v4hi): Update/renamed to
	arc_vec_<V_US>mac_v2hiv2si.
	(arc_vec_<V_US>mac_v2hiv2si_zero): New pattern.
	* config/arc/constraints.md (Ral): Accumulator register
	constraint.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2020-11-09 17:42:00 +02:00
Aldy Hernandez
b5cff0db6e Clean up irange self tests.
Currently we have all the irange and range-op tests in range-op.cc.
This patch splits them up into the appropriate file (irange
tests in value-range.cc and range-op tests in range-op.cc).  The patch
also splits up the tests themselves by functionality.  It's not perfect,
but significantly better than the mess we had.

gcc/ChangeLog:

	* function-tests.c (test_ranges): Call range_op_tests.
	* range-op.cc (build_range3): Move to value-range.cc.
	(range3_tests): Same.
	(int_range_max_tests): Same.
	(multi_precision_range_tests): Same.
	(range_tests): Same.
	(operator_tests): Split up...
	(range_op_tests): Split up...
	(range_op_cast_tests): ...here.
	(range_op_lshift_tests): ...here.
	(range_op_rshift_tests): ...here.
	(range_op_bitwise_and_tests): ...here.
	* selftest.h (range_op_tests): New.
	* value-range.cc (build_range3): New.
	(range_tests_irange3): New.
	(range_tests_int_range_max): New.
	(range_tests_legacy): New.
	(range_tests_misc): New.
	(range_tests): New.
2020-11-09 16:29:47 +01:00
Tobias Burnus
f27a3b37b4 Fortran: Fix OpenACC in specification-part checks [PR90111]
OpenACC's routine and declare directives can appear anywhere in the
specification part, i.e. before/after use-stmts, import-stmt, implicit-part,
or declaration-constructs.

gcc/fortran/ChangeLog:

	PR fortran/90111
	* parse.c (case_decl): Move ST_OACC_ROUTINE and ST_OACC_DECLARE to ...
	(case_omp_decl): ... here.
	(verify_st_order): Update comment.

gcc/testsuite/ChangeLog:

	PR fortran/90111
	* gfortran.dg/goacc/specification-part.f90: New test.
2020-11-09 16:16:44 +01:00
Jonathan Wakely
b2b8516373 libstdc++: Improve comment on _Power_of_2 helper function
libstdc++-v3/ChangeLog:

	* include/bits/uniform_int_dist.h (__detail::_Power_of_2):
	Document that true result for zero is intentional.
2020-11-09 14:54:29 +00:00
Jonathan Wakely
ff4bfb1553 libstdc++: Remove redundant check for zero in std::__popcount
The popcount built-ins work fine for zero, so there's no need to check
for it.

libstdc++-v3/ChangeLog:

	* include/std/bit (__popcount): Remove redundant check for zero.
2020-11-09 14:54:29 +00:00
Richard Biener
96f315213f tree-optimization/97761 - fix SLP live calculation
This removes a premature end of the DFS walk.

2020-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97761
	* tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Remove
	premature end of DFS walk.

	* gfortran.dg/vect/pr97761.f90: New testcase.
2020-11-09 15:50:24 +01:00
Aldy Hernandez
4e85ad79a1 Cleanup irange::set.
[This is actually part of a larger patch that actually changes
behavior, but I thought I'd commit the non-invasive cleanups first
which will simplify the upcoming work.]

irange::set was doing more work than it should for legacy ranges.
I cleaned up various unnecessary calls to swap_out_of_order_endpoints,
as well as some duplicate code that could be done with normalize_min_max.

I also removed an obsolete comment wrt sticky infinite overflows.
Not only did the -INF/+INF(OVF) code get removed in 2017,
but normalize_min_max() uses wide ints, which ignored overflows
altogether.

gcc/ChangeLog:

	* value-range.cc (irange::swap_out_of_order_endpoints): Rewrite
	into static function.
	(irange::set): Cleanup redundant manipulations.
	* value-range.h (irange::normalize_min_max): Modify object
	in-place instead of modifying arguments.
2020-11-09 15:42:10 +01:00
Andrea Corallo
fa59c8dcd2 aarch64: Do not alter force_reg returned register expanding fcmla
2020-11-06  Andrea Corallo  <andrea.corallo@arm.com>

	* config/aarch64/aarch64-builtins.c
	(aarch64_expand_fcmla_builtin): Do not alter force_reg returned
	register.
2020-11-09 15:39:07 +01:00
Jonathan Wakely
0af3930a49 libstdc++: Use 'inline' consistently in std::exception_ptr [PR 97729]
With PR c++/67453 fixed we can rely on the 'used' attribute to emit
inline constructors and destructors in libsupc++/eh_ptr.cc. This means
we don't need to suppress the 'inline' keyword on them in that file, and
don't need to force 'always_inline' on them in other files.

libstdc++-v3/ChangeLog:

	PR libstdc++/97729
	* libsupc++/exception_ptr.h (exception_ptr::exception_ptr())
	(exception_ptr::exception_ptr(const exception_ptr&))
	(exception_ptr::~exception_ptr()): Remove 'always_inline'
	attributes. Use 'inline' unconditionally.
2020-11-09 14:28:38 +00:00
Jonathan Wakely
99bf3a817b libstdc++: Include <typeinfo> even for -fno-rtti [PR 97758]
The std::function code now uses std::type_info* even when RTTI is
disabled, so it should include <typeinfo> unconditionally. Without this,
Clang can't compile <functional> with -fno-rtti (it works with GCC
because std::type_info gets declared automatically by the compiler).

libstdc++-v3/ChangeLog:

	PR libstdc++/97758
	* include/bits/std_function.h [!__cpp_rtti]: Include <typeinfo>.
2020-11-09 14:28:37 +00:00
Jonathan Wakely
8a71317444 config-ml.in: Suppress output from multi-do recipes
The FIXME comments saying "Leave out until this is tested a bit more"
are from 1997. I think they've been sufficiently tested.

ChangeLog:

	* config-ml.in (multi-do, multi-clean): Add @ to silence recipes.
	Remove FIXME comments.
2020-11-09 14:28:37 +00:00
Richard Biener
f5761c318a tree-optimization/97753 - fix SLP induction vect
This fixes updating of the step vectors when filling up to group_size.

2020-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97753
	* tree-vect-loop.c (vectorizable_induction): Fill vec_steps
	when CSEing inside the group.

	* gcc.dg/vect/pr97753.c: New testcase.
2020-11-09 14:57:10 +01:00
Richard Biener
ec735bc764 tree-optimization/97746 - fix order of mask precision computes
This fixes the order of walking PHIs and stmts for BB mask
precision compute.

2020-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97746
	* tree-vect-patterns.c (vect_determine_precisions): First walk PHIs.

	* gcc.dg/vect/bb-slp-pr97746.c: New testcase.
2020-11-09 14:57:10 +01:00
Nathan Sidwell
e38cd64ac6 c++: ADL refactor
This refactors the ADL lookup.  It just so happens the refactoring
makes dropping modules in simpler :) We break apart the namespace and
class fn processing, and move scope iteration to an outer function.
It'll also become possible to find the same enum in multiple place, so
we need to handle that idempotently.

	gcc/cp/
	* cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
	* name-lookup.c (class name_lookup): Add comments.
	(name_lookup::adl_namespace_only): Replace with ...
	(name_lookup::adl_class_fns): ... this and ...
	(name_lookup::adl_namespace_fns): ... this.
	(name_lookup::adl_namespace): Deal with inline nests here.
	(name_lookup::adl_class): Complete the type here.
	(name_lookup::adl_type): Call broken-out enum ..
	(name_lookup::adl_enum): New.  No need to call the namespace adl
	if it is class-scope.
	(name_lookup::search_adl): Iterate over collected scopes here.
2020-11-09 05:09:50 -08:00
Nathan Sidwell
4081596e85 c++: Consistently expose singleton overloads
This is a patch from my name-lookup overhaul.  I noticed the parser
and one path in name-lookup looked through an overload of a single
known decl.  It seems more consistent to do that in both paths through
name-lookup, and not in the parser itself.

	gcc/cp/
	* name-lookup.c (lookup_qualified_name): Expose an overload of a
	singleton with known type.
	(lookup_name_1): Just check the overload's type to expose it.
	* parser.c (cp_parser_lookup_name): Do not do that check here.
2020-11-09 05:09:50 -08:00
Richard Biener
ede8cfb8a4 CSE VN_INFO calls in PRE and VN
The following CSEs VN_INFO calls which nowadays are hashtable queries.

2020-11-09  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c (get_representative_for): CSE VN_INFO calls.
	(create_expression_by_pieces): Likewise.
	(insert_into_preds_of_block): Likewsie.
	(do_pre_regular_insertion): Likewsie.
	* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_insert):
	Likewise.
	(eliminate_dom_walker::eliminate_stmt): Likewise.
2020-11-09 14:07:01 +01:00
Richard Biener
17c25a454e Use a per-edge PRE PHI translation cache
This changes the phi translation cache to be per edge which
pushes it off the profiling radar.  For larger testcases the
combined hashtable causes a load of cache misses and making it
per edge allows to shrink the entry further.

2020-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97765
	* tree-ssa-pre.c (bb_bitmap_sets::phi_translate_table): Add.
	(PHI_TRANS_TABLE): New macro.
	(phi_translate_table): Remove.
	(expr_pred_trans_d::pred): Remove.
	(expr_pred_trans_d::hash): Simplify.
	(expr_pred_trans_d::equal): Likewise.
	(phi_trans_add): Adjust.
	(phi_translate): Likewise.  Remove hash-table expansion
	detection and optimization.
	(phi_translate_set): Allocate PHI_TRANS_TABLE here.
	(init_pre): Adjsust.
	(fini_pre): Free PHI_TRANS_TABLE.
2020-11-09 14:07:01 +01:00
Andrea Corallo
2d4fa1f79c arm: [testcase] Better narrow some bfloat16 testcase
2020-11-05  Andrea Corallo  <andrea.corallo@arm.com>

	* gcc.target/arm/simd/vld1_lane_bf16_1.c: Require target to
	support and add -mfloat-abi=hard flag.
	* gcc.target/arm/simd/vld1_lane_bf16_indices_1.c: Likewise.
	* gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c: Likewise.
	* gcc.target/arm/simd/vst1_lane_bf16_1.c: Likewise.
	* gcc.target/arm/simd/vst1_lane_bf16_indices_1.c: Likewise.
	* gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c: Likewise.
2020-11-09 12:35:18 +01:00
Cui,Lili
dc7e8839c9 Enable MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for march=tremont
1. Enable MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for march=tremont
2. Move PREFETCHW from march=broadwell to march=silvermont.
3. Add PREFETCHWT1 to march=knl

gcc/ChangeLog:

2020-11-09  Lili Cui  <lili.cui@intel.com>

	PR target/97685
	* config/i386/i386.h:
	(PTA_BROADWELL): Delete PTA_PRFCHW.
	(PTA_SILVERMONT): Add PTA_PRFCHW.
	(PTA_KNL): Add PTA_PREFETCHWT1.
	(PTA_TREMONT): Add PTA_MOVDIRI, PTA_MOVDIR64B, PTA_CLDEMOTE and PTA_WAITPKG.
	* doc/invoke.texi: Delete PREFETCHW for broadwell, skylake, knl, knm,
	skylake-avx512, cannonlake, icelake-client, icelake-server, cascadelake,
	cooperlake, tigerlake and sapphirerapids.
	Add PREFETCHW for silvermont, goldmont, goldmont-plus and tremont.
	Add XSAVEC and XSAVES for goldmont, goldmont-plus and tremont.
	Add MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for tremont.
	Add KEYLOCKER and HREST for alderlake.
	Add AMX-BF16, AMX-TILE, AMX-INT8 and UINTR for sapphirerapids.
	Add KEYLOCKER for tigerlake.
2020-11-09 17:26:06 +08:00
Christophe Lyon
946b73c113 libiberty/pex-win32.c: Initialize orig_err
Initializing orig_err avoids a warning: "may be used uninitialized".
See 97108.

2020-09-14  Torbjörn SVENSSON <torbjorn.svensson@st.com>
	Christophe Lyon  <christophe.lyon@linaro.org>

	libiberty/
	* pex-win32.c (pex_win32_exec_child): Initialize orig_err.
2020-11-09 07:15:15 +00:00
Kewen Lin
ce4ae1f489 ira: Recompute regstat as max_regno changes [PR97705]
As PR97705 shows, the commit r11-4637 caused some dumping
comparison difference error on pass ira.  It exposed one
issue about the newly introduced function remove_scratches,
which can increase the largest pseudo reg number if it
succeeds, later some function will use the max_reg_num()
to get the latest max_regno, when iterating the numbers
we can access some data structures which are allocated as
the previous max_regno, some out of array bound accesses
can occur, the failure can be random since the values
beyond the array could be random.

This patch is to free/reinit/recompute the relevant data
structures that is regstat_n_sets_and_refs and reg_info_p
to ensure we won't access beyond some array bounds.

Bootstrapped/regtested on powerpc64le-linux-gnu P9 and
powerpc64-linux-gnu P8.

gcc/ChangeLog:

	PR rtl-optimization/97705
	* ira.c (ira): Refactor some regstat free/init/compute invocation
	into lambda function regstat_recompute_for_max_regno, and call it
	when max_regno increases as remove_scratches succeeds.
2020-11-08 20:35:21 -06:00
GCC Administrator
fb95de7a11 Daily bump. 2020-11-09 00:16:25 +00:00
Iain Sandoe
b642fca1c3 Objective-C/C++ : Handle parsing @property 'class' attribute.
This attribute states that a property is one manipulated by class
methods (it requires a static variable and the setter and getter
must be provided explicitly, they cannot be @synthesized).

gcc/c-family/ChangeLog:

	* c-common.h (OBJC_IS_PATTR_KEYWORD): Add class to the list
	of keywords accepted in @property attribute contexts.
	* c-objc.h (enum objc_property_attribute_group): Add
	OBJC_PROPATTR_GROUP_CLASS.
	(enum objc_property_attribute_kind): Add
	OBJC_PROPERTY_ATTR_CLASS.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_objc_at_property_declaration): Handle
	class keywords in @property attribute context.

gcc/objc/ChangeLog:

	* objc-act.c (objc_prop_attr_kind_for_rid): Handle class
	attribute.
	(objc_add_property_declaration): Likewise.
	* objc-act.h (PROPERTY_CLASS): Record class attribute state.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/property/at-property-4.mm: Test handling class
	attributes.
	* objc.dg/property/at-property-4.m: Likewise.
2020-11-08 09:38:38 +00:00
Iain Sandoe
49393e266a testsuite, Darwin, PPC : Skip zero scratch regs tests.
XFAIL-ing these is not sufficient, unfortunately, we need to
skip them completely.

gcc/testsuite/ChangeLog:

	* c-c++-common/zero-scratch-regs-10.c: Skip for powerpc
	Darwin.
	* c-c++-common/zero-scratch-regs-11.c: Likewise.
	* c-c++-common/zero-scratch-regs-8.c: Likewise.
	* c-c++-common/zero-scratch-regs-9.c: Likewise.
2020-11-08 09:34:36 +00:00
Iain Sandoe
94b74e7aca testsuite, Darwin, X86 : Add target requires native tls to test.
The builtin_thread_pointer test does not work for emulated TLS.
Add a target requires to cover this.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/builtin_thread_pointer.c: Require native TLS.
2020-11-08 09:09:32 +00:00
David Edelsohn
8e620386b8 rs6000: Fix bootstrap after r11-4793.
The patch omitted a change for rs6000.c, fixed thus.

gcc/ChangeLog:

	* config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Change
	DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
2020-11-07 20:43:26 -05:00
GCC Administrator
2da7ee050c Daily bump. 2020-11-08 00:16:31 +00:00
Marek Polacek
bd3cefe450 testsuite: Fix Wimplicit-fallthrough-20.c.
The r11-4813 patch removed "ignored" from the dg-warnings in this test,
causing this test to fail when compiled as C++.

gcc/testsuite/ChangeLog:

	* c-c++-common/Wimplicit-fallthrough-20.c: Adjust dg-warning.
2020-11-07 13:28:43 -05:00
Lewis Hyatt
497c9f8d4d libcpp: Update cpp_wcwidth() to Unicode 13.0.0
generated_cpp_wcwidth.h was regenerated using Unicode 13.0.0 data files. No
material changes to the parsing scripts (either GCC- or glibc-sourced) were
necessary; glibc's utf8_gen.py was tweaked slightly by glibc and matched here.

contrib/ChangeLog:

	* unicode/EastAsianWidth.txt: Update to Unicode 13.0.0.
	* unicode/PropList.txt: Likewise.
	* unicode/README: Likewise.
	* unicode/UnicodeData.txt: Likewise.
	* unicode/from_glibc/unicode_utils.py: Update to latest glibc version.
	* unicode/from_glibc/utf8_gen.py: Likewise.

libcpp/ChangeLog:

	* generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data.
2020-11-07 09:36:43 -05:00
Iain Sandoe
6f762481a2 Objective-C/C++ (C-family) : Add missing 'atomic' property attribute.
This is the default, but it is still legal in user code and therefore
we should handle it in parsing.  Fix whitespace issues in the lines
affected.

gcc/c-family/ChangeLog:

	* c-common.c (c_common_reswords): Add 'atomic' property
	attribute.
	* c-common.h (enum rid): Add RID_PROPATOMIC for atomic
	property attributes.

gcc/objc/ChangeLog:

	* objc-act.c (objc_prop_attr_kind_for_rid): Handle
	RID_PROPATOMIC.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/property/at-property-4.mm: Test atomic property
	attribute.
	* objc.dg/property/at-property-4.m: Likewise.
2020-11-07 11:50:23 +00:00
Iain Sandoe
0c30bf43eb Objective-C : Implement NSObject attribute.
This attribute allows pointers to be marked as pointers to
an NSObject-compatible object.  This allows for additional
checking of assignment etc. when refering to pointers to
opaque types.

gcc/c-family/ChangeLog:

	* c-attribs.c (handle_nsobject_attribute): New.
	* c.opt: Add WNSObject-attribute.

gcc/objc/ChangeLog:

	* objc-act.c (objc_compare_types): Handle NSObject type
	attributes.
	(objc_type_valid_for_messaging): Likewise.

gcc/testsuite/ChangeLog:

	* obj-c++.dg/attributes/nsobject-01.mm: New test.
	* objc.dg/attributes/nsobject-01.m: New test.
2020-11-07 11:45:46 +00:00
Eric Botcazou
df784801da Fix Ada build failure for the SuSE PowerPC64/Linux compiler
gcc/ada/ChangeLog:
	* gcc-interface/Makefile.in: Force target_cpu to powerpc if the
	nominal target is powerpc64-suse-linux.
2020-11-07 11:10:31 +01:00
Iain Sandoe
13193e4000 testsuite, Darwin, PPC : XFAIL zero-scratch-regs tests.
These tests fail because of an unimplemented 'sorry'; there
is no plan to implement this in the short term, so XFAILing
the tests to reduce noise.

gcc/testsuite/ChangeLog:

	* c-c++-common/zero-scratch-regs-10.c: XFAIL for
	powerpc-darwin.
	* c-c++-common/zero-scratch-regs-11.c: Likewise.
	* c-c++-common/zero-scratch-regs-8.c: Likewise.
	* c-c++-common/zero-scratch-regs-9.c: Likewise.
2020-11-07 09:20:54 +00:00
Iain Sandoe
b2a28b8bc1 Ada : Fix bootstrap after r11-4793.
The patch omitted a change for Ada, fixed thus.

gcc/ada/ChangeLog:

	* gcc-interface/misc.c (gnat_printable_name): Change
	DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
2020-11-07 08:43:37 +00:00
Martin Uecker
8b7a9a249a C Parser: Implement mixing of labels and code.
Implement mixing of labels and code as adopted for C2X
and process some std-attributes on labels.

2020-11-06  Martin Uecker  <muecker@gwdg.de>

gcc/
	* doc/extend.texi: Document mixing labels and code.
	* doc/invoke.texi: Likewise.

gcc/c/
	* c-parser.c (c_parser_label): Implement mixing of labels and code.
	(c_parser_all_labels): Likewise.

gcc/testsuite/
	* c-c++-common/attr-fallthrough-2.c: Update compiler flags.
	* c-c++-common/Wimplicit-fallthrough-20.c: Adapt test.
	* gcc.dg/20031223-1.c: Update compiler flags and adapt test.
	* gcc.dg/c11-labels-1.c: New test.
	* gcc.dg/c11-labels-2.c: New test.
	* gcc.dg/c11-labels-3.c: New test.
	* gcc.dg/c2x-attr-syntax-3.c: Adapt test.
	* gcc.dg/c2x-labels-1.c: New test.
	* gcc.dg/c2x-labels-2.c: New test.
	* gcc.dg/c2x-labels-3.c: New test.
	* gcc.dg/decl-9.c: Update compiler flags and add error.
	* gcc.dg/gomp/barrier-2.c: Update compiler flags and add warning.
	* gcc.dg/gomp/declare-simd-5.c: Update compiler flags and adapt test.
	* gcc.dg/gomp/declare-variant-2.c: Update compiler flags and add error.
	* gcc.dg/label-compound-stmt-1.c: Update compiler flags.
	* gcc.dg/parse-decl-after-label.c: Update compiler flags.
2020-11-07 09:13:49 +01:00
Liu Hao
7fc0f78c3f libsupc++: Make the destructor parameter to __cxa_thread_atexit() use the __thiscall calling convention for i686-w64-mingw32
The mingw-w64 implementations of `__cxa_thread_atexit()` and `__cxa_atexit()` have been
using `__thiscall` since two years ago. Using the default calling convention (which is
`__cdecl`) causes crashes as explained in PR83562.

Calling conventions have no effect on x86_64-w64-mingw32.

Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562
Reference: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/crt/cxa_thread_atexit.c
Reference: f3e0fbb40c/
Reference: https://github.com/msys2/MINGW-packages/issues/7071
Signed-off-by: Liu Hao <lh_mouse@126.com>

    2020-10-08  Liu Hao  <lh_mouse@126.com>

	libstdc++-v3:
	* libsupc++/cxxabi.h: (__cxa_atexit): mark with _GLIBCXX_CDTOR_CALLABI
	(__cxa_thread_atexit): ditto
	* libsupc++/atexit_thread.cc: (__cxa_atexit): mark with
	_GLIBCXX_CDTOR_CALLABI
	(__cxa_thread_atexit): ditto
	(elt): ditto
2020-11-07 02:50:43 +00:00