Commit Graph

173254 Commits

Author SHA1 Message Date
Richard Biener
89ee3a872f re PR tree-optimization/92751 (VN partial def support confused about clobbers)
2019-12-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92751
	* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Fail
	when a clobber ends up in the partial-def vector.
	(vn_reference_lookup_3): Let clobbers be handled by the
	assignment from CTOR handling.

	* g++.dg/tree-ssa/pr92751.C: New testcase.

From-SVN: r278931
2019-12-03 10:46:52 +00:00
Eric Botcazou
1058a2262b utils.c (potential_alignment_gap): Delete.
* gcc-interface/utils.c (potential_alignment_gap): Delete.
	(rest_of_record_type_compilation): Do not call above function.  Use
	the alignment of the field instead of that of its type, if need be.
	When the original field has variable size, always lower the alignment
	of the pointer type.  Reset the bit-field status of the new field if
	it does not encode a bit-field.

From-SVN: r278930
2019-12-03 10:23:06 +00:00
Eric Botcazou
cbcf36686e utils.c (fold_convert_size): New function.
* gcc-interface/utils.c (fold_convert_size): New function.
	(fold_bit_position): Invoke it to do further folding.

From-SVN: r278929
2019-12-03 10:12:17 +00:00
Richard Sandiford
dd2dae9438 XFAIL loop_versioning_6.f90 for ! lp64
2019-12-03  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
	* gfortran.dg/loop_versioning_6.f90: XFAIL the scans for ! lp64.

From-SVN: r278928
2019-12-03 10:11:58 +00:00
Eric Botcazou
64c8ebc7b2 decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...
* gcc-interface/decl.c (gnat_to_gnu_subprog_type): With the Copy-In/
	Copy-Out mechanism, do not promote the mode of the return type to an
	integral mode if it contains a field on a non-integral type and even
	demote it for 64-bit targets.

From-SVN: r278927
2019-12-03 10:06:15 +00:00
Jonathan Wakely
819fb01933 libstdc++: Fix copyright date on new test header
The slow_clock type was introduced to the testsuite in 2018 in the
testsuite/30_threads/condition_variable/members/2.cc test, so the new
header should have that date.

	* testsuite/util/slow_clock.h: Fix copyright date.

From-SVN: r278926
2019-12-03 09:51:49 +00:00
Jakub Jelinek
129bd06604 re PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_loc on generic)
PR tree-optimization/92734
	* match.pd ((CST1 - A) +- CST2 -> CST3 - A,
	CST1 - (CST2 - A) -> CST3 + A): Handle nop casts around
	inner subtraction.

	* gcc.dg/tree-ssa/pr92734.c: New test.

From-SVN: r278925
2019-12-03 10:20:43 +01:00
Uros Bizjak
a4c772e26d re PR target/92744 (error: insn does not satisfy its constraints since r278439)
PR target/92744
	* config/i386/i386.md (peephole2 for *swap<mode>): Use
	general_reg_operand predicates instead of register_operand.

	* g++.dg/dfp/pr92744.C: New test.

From-SVN: r278924
2019-12-03 09:23:06 +01:00
Jakub Jelinek
6fcb7ebb37 re PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)
PR c++/92732
	* typeck2.c (digest_nsdmi_init): For bitfields, use
	DECL_BIT_FIELD_TYPE instead of TREE_TYPE.

	* g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion
	warnings.
	* g++.dg/cpp2a/bitfield4.C: New test.

From-SVN: r278923
2019-12-03 09:21:29 +01:00
Jason Merrill
e0daa2c86b re PR c++/92705 (ICE: Segmentation fault (in build_new_op_1))
PR c++/92705
	* call.c (strip_standard_conversion): New function.
	(build_new_op_1): Use it for user_conv_p.
	(compare_ics): Likewise.
	(source_type): Likewise.

	* g++.dg/conversion/ambig4.C: New test.

From-SVN: r278922
2019-12-03 09:20:18 +01:00
Jakub Jelinek
5558a0da32 re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
PR c++/92695
	* constexpr.c (cxx_bind_parameters_in_call): For virtual calls,
	adjust the first argument to point to the derived object rather
	than its base.

	* g++.dg/cpp2a/constexpr-virtual14.C: New test.

From-SVN: r278921
2019-12-03 09:19:04 +01:00
Richard Biener
3d109462bd re PR tree-optimization/92645 (Hand written vector code is 450 times slower when compiled with GCC compared to Clang)
2019-12-03  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92645
	* tree-ssa.c (execute_update_addresses_taken): Avoid representing
	a full def of a vector via a BIT_INSERT_EXPR.

From-SVN: r278920
2019-12-03 07:36:14 +00:00
Luo Xiong Hu
19d9824ba0 Fix missing space of r278890
gcc/testsuite/ChangeLog:

	2019-12-03  Luo Xiong Hu  <luoxhu@linux.ibm.com>

	* gcc.target/powerpc/pr72804.c: Fix missing space.

From-SVN: r278918
2019-12-03 01:46:16 +00:00
Joseph Myers
85d1195708 Diagnose use of [*] in old-style parameter definitions (PR c/88704).
GCC wrongly accepts [*] in old-style parameter definitions because
because parm_flag is set on the scope used for those definitions and,
unlike the case of a prototype in a function definition, there is no
subsequent check to disallow this invalid usage.  This patch adds such
a check.  (At this point we don't have location information for the
[*], so the diagnostic location isn't ideal.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

	PR c/88704
gcc/c:
	* c-decl.c (store_parm_decls_oldstyle): Diagnose use of [*] in
	old-style parameter definitions.

gcc/testsuite:
	* gcc.dg/vla-25.c: New test.

From-SVN: r278917
2019-12-03 01:27:43 +00:00
Jakub Jelinek
b650026dff inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of -fdump-ipa-inline.
* g++.dg/lto/inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details
	instead of -fdump-ipa-inline.  Use "inline" instead of "inlined" as
	last argument to scan-wpa-ipa-dump-times, use \\\( and \\\) instead of
	( and ) in the regex.

From-SVN: r278916
2019-12-03 01:33:27 +01:00
GCC Administrator
145820ef46 Daily bump.
From-SVN: r278915
2019-12-03 00:16:19 +00:00
Jakub Jelinek
3a0bd58fac re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
PR c++/92695
	* constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
	STRIP_NOPS before checking for ADDR_EXPR.

	* g++.dg/cpp2a/constexpr-virtual15.C: New test.

From-SVN: r278912
2019-12-02 22:33:06 +01:00
Bill Schmidt
871a8fab25 Make rs6000_invalid_builtin static.
2019-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

	* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Make
	static.
	* config/rs6000/rs6000-internal.h (rs6000_invalid_builtin): Remove
	decl.

From-SVN: r278911
2019-12-02 18:46:45 +00:00
Richard Sandiford
fddcfa5b84 Tighten check for vector types in fold_convertible_p (PR 92741)
In this PR, IPA-CP was misled into using NOP_EXPR rather than
VIEW_CONVERT_EXPR to reinterpret a vector of 4 shorts as a vector
of 2 ints.  This tripped the tree-cfg.c assert I'd added in r278245.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR middle-end/92741
	* fold-const.c (fold_convertible_p): Check vector types more
	thoroughly.

gcc/testsuite/
	PR middle-end/92741
	* gcc.dg/pr92741.c: New test.

From-SVN: r278910
2019-12-02 17:51:08 +00:00
Richard Sandiford
c0e0174bbd [AArch64] Catch attempts to use SVE types when SVE is disabled
This patch reports an error if code tries to use variable-length
SVE types when SVE is disabled.  We already report a similar error
for definitions or uses of SVE functions when SVE is disabled.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64.c (aarch64_report_sve_required): New function.
	(aarch64_expand_mov_immediate): Use it when attempting to measure
	the length of an SVE vector.
	(aarch64_mov_operand_p): Only allow SVE CNT immediates when
	SVE is enabled.

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general/nosve_4.c: New test.
	* gcc.target/aarch64/sve/acle/general/nosve_5.c: Likewise.
	* gcc.target/aarch64/sve/pcs/nosve_4.c: Expected a second error
	for the copy.
	* gcc.target/aarch64/sve/pcs/nosve_5.c: Likewise.
	* gcc.target/aarch64/sve/pcs/nosve_6.c: Likewise.

From-SVN: r278909
2019-12-02 17:48:08 +00:00
Richard Sandiford
6da4c454ac [AArch64] Run general SVE ACLE tests for C
Now that the C frontend can cope with POLY_INT_CST-length initialisers,
we can make aarch64-sve-acle.exp run the full set of tests.  This will
introduce new failures for -mabi=ilp32; I'll make the testsuite ILP32
clean separately.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Run the
	general/* tests too.

From-SVN: r278908
2019-12-02 17:44:30 +00:00
Richard Sandiford
0435b10db0 [AArch64] Add a couple of SVE ACLE comparison folds
When writing vector-length specific SVE code, it's useful to be able
to store an svbool_t predicate in a GNU vector of unsigned chars.
This patch makes sure that there is no overhead when converting
to that form and then immediately reading it back again.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64-sve-builtins.h
	(gimple_folder::force_vector): Declare.
	* config/aarch64/aarch64-sve-builtins.cc
	(gimple_folder::force_vector): New function.
	* config/aarch64/aarch64-sve-builtins-base.cc
	(svcmp_impl::fold): Likewise.
	(svdup_impl::fold): Handle svdup_z too.

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general/eqne_dup_1.c: New test.
	* gcc.target/aarch64/sve/acle/asm/dup_f16.c (dup_0_f16_z): Expect
	the call to be folded to zero.
	* gcc.target/aarch64/sve/acle/asm/dup_f32.c (dup_0_f32_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_f64.c (dup_0_f64_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_s8.c (dup_0_s8_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_s16.c (dup_0_s16_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_s32.c (dup_0_s32_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_s64.c (dup_0_s64_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_u8.c (dup_0_u8_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_u16.c (dup_0_u16_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_u32.c (dup_0_u32_z): Likewise.
	* gcc.target/aarch64/sve/acle/asm/dup_u64.c (dup_0_u64_z): Likewise.

From-SVN: r278907
2019-12-02 17:39:06 +00:00
Sudakshina Das
d6098f6481 [Committed][Arm][testsuite] Fix failure for arm-fp16-ops-*.C
Since r275022 which deprecates some uses of volatile, all arm-fp16-ops-*.C
were failing with warnings of deprecated valatile uses on arm-none-eabi and
arm-none-linux-gnueabihf. This patch removes the volatile declarations from
the header. Since none of the tests are run with any high optimization levels,
this should change should not prevent the real function of the tests.

gcc/testsuite/ChangeLog:

2019-12-02  Sudakshina Das  <sudi.das@arm.com>

	* g++.dg/ext/arm-fp16/arm-fp16-ops.h: Remove volatile keyword.

From-SVN: r278905
2019-12-02 17:21:35 +00:00
Mike Crowe
b789efeae8 libstdc++: Fix try_lock_until and try_lock_shared_until on arbitrary clock
This is the equivalent to PR libstdc++/91906, but for shared_mutex.

A non-standard clock may tick more slowly than std::chrono::steady_clock.
This means that we risk returning false early when the specified timeout
may not have expired. This can be avoided by looping until the timeout time
as reported by the non-standard clock has been reached.

Unfortunately, we have no way to tell whether the non-standard clock ticks
more quickly that std::chrono::steady_clock. If it does then we risk
returning later than would be expected, but that is unavoidable without
waking up periodically to check, which would be rather too expensive.

François Dumont pointed out[1] a flaw in an earlier version of this patch
that revealed a hole in the test coverage, so I've added a new test that
try_lock_until acts as try_lock if the timeout has already expired.

[1] https://gcc.gnu.org/ml/libstdc++/2019-10/msg00021.html

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	Fix try_lock_until and try_lock_shared_until on arbitrary clock
	* include/std/shared_mutex (shared_timed_mutex::try_lock_until)
	(shared_timed_mutex::try_lock_shared_until): Loop until the absolute
	timeout time is reached as measured against the appropriate clock.
	* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
	file. Test try_lock_until and try_lock_shared_until timeouts against
	various clocks.
	* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
	file. Test try_lock_until and try_lock_shared_until timeouts against
	various clocks.

From-SVN: r278904
2019-12-02 16:23:14 +00:00
Mike Crowe
ab40695a46 libstdc++: Add full steady_clock support to shared_timed_mutex
The pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock functions
were added to glibc in v2.30. They have also been added to Android
Bionic. If these functions are available in the C library then they can
be used to implement shared_timed_mutex::try_lock_until,
shared_timed_mutex::try_lock_for,
shared_timed_mutex::try_lock_shared_until and
shared_timed_mutex::try_lock_shared_for so that they are no longer
unaffected by the system clock being warped. (This is the shared_mutex
equivalent of PR libstdc++/78237 for mutex.)

If the new functions are available then steady_clock is deemed to be the
"best" clock available which means that it is used for the relative
try_lock_for calls and absolute try_lock_until calls using steady_clock
and user-defined clocks. It's not possible to have
_GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK defined without
_GLIBCXX_USE_PTHREAD_RWLOCK_T, so the requirement that the clock be the
same as condition_variable is maintained. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via the old pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock
functions.

If the new functions are not available then system_clock is deemed to be
the "best" clock available which means that the previous suboptimal
behaviour remains.

Additionally, the user-defined clock used with
shared_timed_mutex::try_lock_for and shared_mutex::try_lock_shared_for
may have higher precision than __clock_t. We may need to round the
duration up to ensure that the timeout is long enough. (See
__timed_mutex_impl::_M_try_lock_for)

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	Add full steady_clock support to shared_timed_mutex
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK): Define
	to check for the presence of both pthread_rwlock_clockrdlock and
	pthread_rwlock_clockwrlock.
	* config.h.in: Regenerate.
	* configure.ac: Call GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK.
	* configure: Regenerate.
	* include/std/shared_mutex (shared_timed_mutex): Define __clock_t as
	the best clock to use for relative waits.
	(shared_timed_mutex::try_lock_for) Round up wait duration if necessary.
	(shared_timed_mutex::try_lock_shared_for): Likewise.
	(shared_timed_mutex::try_lock_until): Use existing try_lock_until
	implementation for system_clock (which matches __clock_t when
	_GLIBCCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK is not defined). Add new
	overload for steady_clock that uses pthread_rwlock_clockwrlock if it
	is available. Simplify overload for non-standard clock to just call
	try_lock_for with a relative timeout.
	(shared_timed_mutex::try_lock_shared_until): Likewise.

From-SVN: r278903
2019-12-02 16:23:10 +00:00
Mike Crowe
a7334019b1 libstdc++: Fix timed_mutex::try_lock_until on arbitrary clock (PR 91906)
A non-standard clock may tick more slowly than
std::chrono::steady_clock.  This means that we risk returning false
early when the specified timeout may not have expired. This can be
avoided by looping until the timeout time as reported by the
non-standard clock has been reached.

Unfortunately, we have no way to tell whether the non-standard clock
ticks more quickly that std::chrono::steady_clock. If it does then we
risk returning later than would be expected, but that is unavoidable and
permitted by the standard.

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	PR libstdc++/91906 Fix timed_mutex::try_lock_until on arbitrary clock
	* include/std/mutex (__timed_mutex_impl::_M_try_lock_until): Loop
	until the absolute timeout time is reached as measured against the
	appropriate clock.
	* testsuite/util/slow_clock.h: New file. Move implementation of
	slow_clock test class.
	* testsuite/30_threads/condition_variable/members/2.cc: Include
	slow_clock from header.
	* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Convert
	existing test to templated function so that it can be called with
	both system_clock and steady_clock.
	* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: Also run test
	using slow_clock to test above fix.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/4.cc: Add
	new test that try_lock_until behaves as try_lock if the timeout has
	already expired or exactly matches the current time.

From-SVN: r278902
2019-12-02 16:23:06 +00:00
Mike Crowe
3b2fb54353 libstdc++: PR 78237 Add full steady_clock support to timed_mutex
The pthread_mutex_clocklock function is available in glibc since the
2.30 release. If this function is available in the C library it can be
used to fix PR libstdc++/78237 by supporting steady_clock properly with
timed_mutex.

This means that code using timed_mutex::try_lock_for or
timed_mutex::wait_until with steady_clock is no longer subject to timing
out early or potentially waiting for much longer if the system clock is
warped at an inopportune moment.

If pthread_mutex_clocklock is available then steady_clock is deemed to
be the "best" clock available which means that it is used for the
relative try_lock_for calls and absolute try_lock_until calls using
steady_clock and user-defined clocks. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via __gthread_cond_timedwait.

If pthread_mutex_clocklock is not available then system_clock is deemed
to be the "best" clock available which means that the previous
suboptimal behaviour remains.

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	PR libstdc++/78237 Add full steady_clock support to timed_mutex
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Define to
	detect presence of pthread_mutex_clocklock function.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Call GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK.
	* include/std/mutex (__timed_mutex_impl): Remove unnecessary __clock_t.
	(__timed_mutex_impl::_M_try_lock_for): Use best clock to turn relative
	timeout into absolute timeout.
	(__timed_mutex_impl::_M_try_lock_until): Keep existing implementation
	for system_clock. Add new implementation for steady_clock that calls
	_M_clocklock. Modify overload for user-defined clock to use a relative
	wait so that it automatically uses the best clock.
	[_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK] (timed_mutex::_M_clocklock):
	New member function.
	(recursive_timed_mutex::_M_clocklock): Likewise.

From-SVN: r278901
2019-12-02 16:23:01 +00:00
Mike Crowe
49638674a4 libstdc++: Improve tests for try_lock_until members of mutex types
2019-12-02  Mike Crowe  <mac@mcrowe.com>

	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
	New test. Ensure that timed_mutex::try_lock_until actually times out
	after the specified time when using both system_clock and
	steady_clock.
	* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: New test.
	Likewise but for recursive_timed_mutex.
	* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Template
	test functions and use them to test both steady_clock and system_clock.
	* testsuite/30_threads/unique_lock/locking/4.cc: Likewise. Wrap call
	to timed_mutex::try_lock_until in VERIFY macro to check its return
	value.

From-SVN: r278900
2019-12-02 16:22:53 +00:00
Martin Liska
74fee04253 Refactor IPA devirt a bit.
2019-12-02  Martin Liska  <mliska@suse.cz>

	* ipa-devirt.c (warn_types_mismatch): Use get_odr_name_for_type
	function.
	(debug_tree_odr_name): New.
	* ipa-utils.h (get_odr_name_for_type): New.
2019-12-02  Martin Liska  <mliska@suse.cz>

	* g++.dg/lto/odr-7_0.C: New test.
	* g++.dg/lto/odr-7_1.C: New test.

From-SVN: r278898
2019-12-02 11:18:31 +00:00
Jan Hubicka
f87c23751a Fix dg failure
* g++.dg/lto/inline-crossmodule-1_0.C: fix template.

From-SVN: r278897
2019-12-02 11:11:34 +00:00
Richard Biener
2679730bab re PR tree-optimization/92742 (ICE in info_for_reduction, at tree-vect-loop.c:4367)
2019-12-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92742
	* tree-vect-loop.c (vect_fixup_reduc_chain): Do not
	touch the def-type but verify it is consistent with the
	original stmts.

	* gcc.dg/torture/pr92742.c: New testcase.

From-SVN: r278896
2019-12-02 10:50:45 +00:00
Jakub Jelinek
a213ab3856 re PR tree-optimization/92712 (Performance regression with assumed values)
PR tree-optimization/92712
	* match.pd ((A * B) +- A -> (B +- 1) * A,
	A +- (A * B) -> (1 +- B) * A): Allow optimizing signed integers
	even when we don't know anything about range of A, but do know
	something about range of B and the simplification won't introduce
	new UB.

	* gcc.dg/tree-ssa/pr92712-1.c: New test.
	* gcc.dg/tree-ssa/pr92712-2.c: New test.
	* gcc.dg/tree-ssa/pr92712-3.c: New test.
	* gfortran.dg/loop_versioning_1.f90: Adjust expected number of
	likely to be innermost dimension messages.
	* gfortran.dg/loop_versioning_10.f90: Likewise.
	* gfortran.dg/loop_versioning_6.f90: Likewise.

From-SVN: r278894
2019-12-02 09:51:49 +01:00
Feng Xue
9b14fc3326 Enable recursive function versioning
2019-12-02  Feng Xue <fxue@os.amperecomputing.com>

        PR ipa/92133
        * doc/invoke.texi (ipa-cp-max-recursive-depth): Document new option.
        (ipa-cp-min-recursive-probability): Likewise.
        * params.opt (ipa-cp-max-recursive-depth): New.
        (ipa-cp-min-recursive-probability): Likewise.
        * ipa-cp.c (ipcp_lattice<valtype>::add_value): Add two new parameters
        val_p and unlimited.
        (self_recursively_generated_p): New function.
        (get_val_across_arith_op): Likewise.
        (propagate_vals_across_arith_jfunc): Add constant propagation for
        self-recursive function.
        (incorporate_penalties): Do not penalize pure self-recursive function.
        (good_cloning_opportunity_p): Dump node_is_self_scc flag.
        (propagate_constants_topo): Set node_is_self_scc flag for cgraph node.
        (get_info_about_necessary_edges): Relax hotness check for edge to
        self-recursive function.
        * ipa-prop.h (ipa_node_params): Add new field node_is_self_scc.

2019-12-02  Feng Xue  <fxue@os.amperecomputing.com>

        PR ipa/92133
        * gcc.dg/ipa/ipa-clone-2.c: New test.

From-SVN: r278893
2019-12-02 06:37:30 +00:00
Sandra Loosemore
4569f8b365 Fix bugs relating to flexibly-sized objects in nios2 backend.
2019-12-01  Sandra Loosemore  <sandra@codesourcery.com>

	Fix bugs relating to flexibly-sized objects in nios2 backend.

	PR target/92499

	gcc/c/
	* c-decl.c (flexible_array_type_p): Move to common code.

	gcc/
	* config/nios2/nios2.c (nios2_in_small_data_p): Do not consider
	objects of flexible types to be small if they have internal linkage
	or are declared extern.
	* config/nios2/nios2.h (ASM_OUTPUT_ALIGNED_LOCAL): Replace with...
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): ...this.  Use targetm.in_small_data_p
	instead of the size of the object initializer.
	* tree.c (flexible_array_type_p): Move from C front end, and
	generalize to handle fields in non-C structures.
	* tree.h (flexible_array_type_p): Declare.

	gcc/testsuite/
	* gcc.target/nios2/pr92499-1.c: New.
	* gcc.target/nios2/pr92499-2.c: New.
	* gcc.target/nios2/pr92499-3.c: New.

From-SVN: r278891
2019-12-01 22:52:15 -05:00
Luo Xiong Hu
e549dd44b5 PR92398: Fix testcase failure of pr72804.c
P9LE generated instruction is not worse than P8LE.
mtvsrdd;xxlnot;stxv vs. not;not;std;std.
It can have longer latency, but latency via memory is not so critical,
and this does save decode and other resources.  It's hard to choose
which is best.  Update the test case to fix failures.

gcc/testsuite/ChangeLog:

	2019-12-02  Luo Xiong Hu  <luoxhu@linux.ibm.com>

	PR testsuite/92398
	* gcc.target/powerpc/pr72804.c: Split the store function to...
	* gcc.target/powerpc/pr92398.h: ... this one.  New.
	* gcc.target/powerpc/pr92398.p9+.c: New.
	* gcc.target/powerpc/pr92398.p9-.c: New.
	* lib/target-supports.exp (check_effective_target_p8): New.
	(check_effective_target_p9+): New.

From-SVN: r278890
2019-12-02 01:59:26 +00:00
GCC Administrator
aa2d575313 Daily bump.
From-SVN: r278889
2019-12-02 00:16:12 +00:00
Jerry DeLisle
e51e2058f0 re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and ew.d e0 edit descriptors for output)
2019-12-01  Jerry DeLisle  <jvdelisle@gcc.ngu.org>

	PR fortran/90374
	* io/format.c (parse_format_list): Add braces to disambiguate
	conditional.

From-SVN: r278886
2019-12-01 22:29:43 +00:00
Jan Hubicka
51b7445735 profile-count.h (profile_count::operator<): Use IPA value for comparsion.
* profile-count.h (profile_count::operator<): Use IPA value for
	comparsion.
	(profile_count::operator>): Likewise.
	(profile_count::operator<=): Likewise.
	(profile_count::operator>=): Likewise.
	* predict.c (maybe_hot_count_p): Do not convert to gcov_type.

From-SVN: r278885
2019-12-01 15:12:52 +00:00
GCC Administrator
1f7a540c11 Daily bump.
From-SVN: r278883
2019-12-01 00:16:25 +00:00
Jan Hubicka
8fcfc44f61 ipa-inline.c (compute_max_insns): Return int64_t.
* ipa-inline.c (compute_max_insns): Return int64_t.
	(inline_small_functions): Simplify.

From-SVN: r278880
2019-11-30 23:19:58 +00:00
Jan Hubicka
a9a4edf0e7 Update max_bb_count in execute_fixup_cfg
* tree-cfg.c (execute_fixup_cfg): Update also max_bb_count when
	scaling happen.

From-SVN: r278879
2019-11-30 21:25:24 +00:00
Jan Hubicka
d7ddfbcb7f cgraph.h (symtab_node): Add symver flag.
2019-11-30  Jan Hubicka  <hubicka@ucw.cz>

	* cgraph.h (symtab_node): Add symver flag.
	* cgraphunit.c (process_symver_attribute): New.
	(process_common_attributes): Use process_symver_attribute.
	* lto-cgraph.c (lto_output_node): Stream symver.
	(lto_output_varpool_node): Stream symver.
	(input_overwrite_node): Stream symver.
	(input_varpool_node): Stream symver.
	* output.h (do_assemble_symver): Decalre.
	* symtab.c (symtab_node::dump_base): Dump symver.
	(symtab_node::verify_base): Verify symver.
	(symtab_node::resolve_alias): Handle symver.
	* varasm.c (do_assemble_symver): New function.
	* varpool.c (varpool_node::assemble_aliases): Use it.
	* doc/extend.texi: (symver attribute): Document.
	* config/elfos.h (ASM_OUTPUT_SYMVER_DIRECTIVE): New.

c-family/ChangeLog:

2019-11-30  Jan Hubicka  <hubicka@ucw.cz>

	* c-attribs.c (handle_symver_attribute): New function
	(c_common_attributes): Add symver.

From-SVN: r278878
2019-11-30 21:03:25 +00:00
Richard Sandiford
65ef05d0b7 [C] Add a target hook that allows targets to verify type usage
This patch adds a new target hook to check whether there are any
target-specific reasons why a type cannot be used in a certain
source-language context.  It works in a similar way to existing
hooks like TARGET_INVALID_CONVERSION and TARGET_INVALID_UNARY_OP.

The reason for adding the hook is to report invalid uses of SVE types.
Throughout a TU, the SVE vector and predicate types represent values
that can be stored in an SVE vector or predicate register.  At certain
points in the TU we might be able to generate code that assumes the
registers have a particular size, but often we can't.  In some cases
we might even make multiple different assumptions in the same TU
(e.g. when implementing an ifunc for multiple vector lengths).

But SVE types themselves are the same type throughout.  The register
size assumptions change how we generate code, but they don't change
the definition of the types.

This means that the types do not have a fixed size at the C level
even when -msve-vector-bits=N is in effect.  It also means that the
size does not work in the same way as for C VLAs, where the abstract
machine evaluates the size at a particular point and then carries that
size forward to later code.

The SVE ACLE deals with this by making it invalid to use C and C++
constructs that depend on the size or layout of SVE types.  The spec
refers to the types as "sizeless" types and defines their semantics as
edits to the standards.  See:

  https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00868.html

for a fuller description and:

  https://gcc.gnu.org/ml/gcc/2019-11/msg00088.html

for a recent update on the status.

However, since all current sizeless types are target-specific built-in
types, there's no real reason for the frontends to handle them directly.
They can just hand off the checks to target code instead.  It's then
possible for the errors to refer to "SVE types" rather than "sizeless
types", which is likely to be more meaningful to users.

There is a slight overlap between the new tests and the ones for
gnu_vector_type_p in r277950, but here the emphasis is on testing
sizelessness.

2019-11-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* target.h (type_context_kind): New enum.
	(verify_type_context): Declare.
	* target.def (verify_type_context): New target hook.
	* doc/tm.texi.in (TARGET_VERIFY_TYPE_CONTEXT): Likewise.
	* doc/tm.texi: Regenerate.
	* tree.c (verify_type_context): New function.
	* config/aarch64/aarch64-protos.h (aarch64_sve::verify_type_context):
	Declare.
	* config/aarch64/aarch64-sve-builtins.cc (verify_type_context):
	New function.
	* config/aarch64/aarch64.c (aarch64_verify_type_context): Likewise.
	(TARGET_VERIFY_TYPE_CONTEXT): Define.

gcc/c-family/
	* c-common.c (pointer_int_sum): Use verify_type_context to check
	whether the target allows pointer arithmetic for the types involved.
	(c_sizeof_or_alignof_type, c_alignof_expr): Use verify_type_context
	to check whether the target allows sizeof and alignof operations
	for the types involved.

gcc/c/
	* c-decl.c (start_decl): Allow initialization of variables whose
	size is a POLY_INT_CST.
	(finish_decl): Use verify_type_context to check whether the target
	allows variables with a particular type to have static or thread-local
	storage duration.  Don't raise a second error if such variables do
	not have a constant size.
	(grokdeclarator): Use verify_type_context to check whether the
	target allows fields or array elements to have a particular type.
	* c-typeck.c (pointer_diff): Use verify_type_context to test whether
	the target allows pointer difference for the types involved.
	(build_unary_op): Likewise for pointer increment and decrement.

gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: New test.
	* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise.

From-SVN: r278877
2019-11-30 18:50:06 +00:00
Jan Hubicka
b74d8dc4cf cgraph.c (cgraph_node::dump): Dump unit_id and merged_extern_inline.
* cgraph.c (cgraph_node::dump): Dump unit_id and merged_extern_inline.
	* cgraph.h (cgraph_node): Add unit_id and
	merged_extern_inline.
	(symbol_table): Add max_unit.
	(symbol_table::symbol_table): Initialize it.
	* cgraphclones.c (duplicate_thunk_for_node): Copy unit_id.
	merged_comdat, merged_extern_inline.
	(cgraph_node::create_clone): Likewise.
	(cgraph_node::create_version_clone): Likewise.
	* ipa-fnsummary.c (dump_ipa_call_summary): Dump info about cross module
	calls.
	* ipa-fnsummary.h (cross_module_call_p): New inline function.
	* ipa-inline-analyssi.c (simple_edge_hints): Use it.
	* ipa-inline.c (inline_small_functions): Likewise.
	* lto-symtab.c (lto_cgraph_replace_node): Record merged_extern_inline;
	copy merged_comdat and merged_extern_inline.
	* lto-cgraph.c (lto_output_node): Stream out merged_comdat,
	merged_extern_inline and unit_id.
	(input_overwrite_node): Stream in these.
	(input_cgraph_1): Set unit_base.
	* lto-streamer.h (lto_file_decl_data): Add unit_base.
	* symtab.c (symtab_node::make_decl_local): Record former_comdat.

	* g++.dg/lto/inline-crossmodule-1.h: New testcase.
	* g++.dg/lto/inline-crossmodule-1_0.C: New testcase.
	* g++.dg/lto/inline-crossmodule-1_1.C: New testcase.

From-SVN: r278876
2019-11-30 16:56:45 +00:00
Thomas Koenig
f9235a2baf Do not look at _data component in gfc_dep_resolver.
2019-11-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/91783
	* dependency.c (gfc_dep_resolver): Do not look at _data
	component if present.

2019-11-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/91783
	* gfortran.dg/dependency_56.f90: New test.

From-SVN: r278873
2019-11-30 15:02:50 +00:00
Maciej W. Rozycki
7a4f45d7e6 driver: Do not warn about ineffective `-x' option if no inputs were given
Fix an issue with the GCC driver and the `-x' option where a warning is
issued in an invocation like:

$ riscv64-linux-gnu-gcc -print-multi-directory -x c++
riscv64-linux-gnu-gcc: warning: '-x c++' after last input file has no effect
lib64/lp64d
$ 

where no inputs were given and hence the use of `-x' is irrelevant.
The statement printed is also untrue as the `-x' does not come after the
last input file given that none was given.  Do not print it then if no
inputs were supplied.

	* gcc.c (process_command): Only warn about an ineffective `-x'
	option if any input files have actually been supplied.

From-SVN: r278872
2019-11-30 11:10:50 +00:00
Maciej W. Rozycki
bd661b0f25 doc: Correct `--enable-version-specific-runtime-libs' support information
The `--enable-version-specific-runtime-libs' configuration option is now
supported throughout all of our target library subdirectories, so update
installation documentation accordingly and also mention that the default
for the option is `yes' for libada and `no' for the remaining libraries.

	gcc/
	* doc/install.texi (Options specification): Remove the list of
	target library subdirectories supporting
	`--enable-version-specific-runtime-libs'.  Document defaults for
	the option.

From-SVN: r278871
2019-11-30 11:06:59 +00:00
Jonathan Wakely
f0cfae9f4e libstdc++: Default to --enable-libstdcxx-filesystem-ts for *-*-mingw*
* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS): Enable by default for
	mingw targets.
	* configure: Regenerate.

From-SVN: r278870
2019-11-30 01:03:40 +00:00
Jonathan Wakely
3eda32cb9b libstdc++: Fix experimental::filesystem::u8path(const Source&) for Windows
This function failed to compile when called with a std::string.

Also, constructing a path with a char8_t string did not correctly treat
the string as already UTF-8 encoded.

	* include/bits/fs_path.h (u8path(InputIterator, InputIterator))
	(u8path(const Source&)) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Simplify
	conditions.
	* include/experimental/bits/fs_path.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
	(__u8path(const Source&, char)): Add overloads for std::string and
	types convertible to std::string.
	(_Cvt::_S_wconvert): Add a new overload for char8_t strings and use
	codecvt_utf8_utf16 to do the correct conversion.

From-SVN: r278869
2019-11-30 01:03:36 +00:00
GCC Administrator
aa80d0650c Daily bump.
From-SVN: r278868
2019-11-30 00:16:20 +00:00