Jonathan Wakely [Sat, 29 Aug 2020 17:24:08 +0000 (18:24 +0100)]
libstdc++: Fix deleted overload of __absu(bool)
libstdc++-v3/ChangeLog:
* include/std/numeric (__detail::__absu(bool)): Make deleted
function a function template, so it will be chosen for calls
with an explicit template argument list.
* testsuite/26_numerics/gcd/gcd_neg.cc: Add dg-prune-output.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
Bill Schmidt [Sat, 29 Aug 2020 01:05:58 +0000 (20:05 -0500)]
rs6000: Remove ALTIVEC_BUILTIN_MASK_FOR_STORE
It turns out that the target hook that this is supposed to satisfy
disappeared in 2004. Probably time to retire it.
2020-08-28 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin.def (MASK_FOR_STORE): Remove.
* config/rs6000/rs6000-call.c (rs6000_expand_builtin): Remove
all logic for ALTIVEC_BUILTIN_MASK_FOR_STORE.
GCC Administrator [Sat, 29 Aug 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Fri, 28 Aug 2020 22:41:13 +0000 (23:41 +0100)]
libstdc++: Fix common_type specializations for duration
My recent change to implement P0548 ("common_type and duration") was not
correct. The result of common_type_t<duration<R,P>, duration<R,P>>
should be duration<common_type_t<R>, P::type>, not duration<R, P::type>.
The common_type specialization for two different duration types was
correct, but the specializations for a single duration type (which only
exist to optimize compilation time) were wrong.
This fixes the partial specializations of common_type for a single
duration type, and also the return types of duration::operator+ and
duration::operator- which are supposed to use common_type_t<duration>.
libstdc++-v3/ChangeLog:
* include/std/chrono (common_type): Fix partial specializations
for a single duration type to use the common_type of the rep.
(duration::operator+, duration::operator-): Fix return types
to also use the common_type of the rep.
* testsuite/20_util/duration/requirements/reduced_period.cc:
Check duration using a rep that has common_type specialized.
Jonathan Wakely [Fri, 28 Aug 2020 21:45:24 +0000 (22:45 +0100)]
libstdc++: Fix std::gcd and std::lcm for unsigned integers [PR 92978]
This fixes a bug with mixed signed and unsigned types, where converting
a negative value to the unsigned result type alters the value. The
solution is to obtain the absolute values of the arguments immediately
and to perform the actual GCD or LCM algorithm on two arguments of the
same type.
In order to operate on the most negative number without overflow when
taking its absolute, use an unsigned type for the result of the abs
operation. For example, -INT_MIN will overflow, but -(unsigned)INT_MIN
is (unsigned)INT_MAX+1U which is the correct value.
libstdc++-v3/ChangeLog:
PR libstdc++/92978
* include/std/numeric (__abs_integral): Replace with ...
(__detail::__absu): New function template that returns an
unsigned type, guaranteeing it can represent the most
negative signed value.
(__detail::__gcd, __detail::__lcm): Require arguments to
be unsigned and therefore already non-negative.
(gcd, lcm): Convert arguments to absolute value as unsigned
type before calling __detail::__gcd or __detail::__lcm.
* include/experimental/numeric (gcd, lcm): Likewise.
* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust expected
errors.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
* testsuite/26_numerics/gcd/92978.cc: New test.
* testsuite/26_numerics/lcm/92978.cc: New test.
* testsuite/experimental/numeric/92978.cc: New test.
Martin Sebor [Fri, 28 Aug 2020 19:13:28 +0000 (13:13 -0600)]
Add -Wstringop-overread for reading past the end by string functions.
gcc/ChangeLog:
* attribs.c (init_attr_rdwr_indices): Use global access_mode.
* attribs.h (struct attr_access): Same.
* builtins.c (fold_builtin_strlen): Add argument.
(compute_objsize): Declare.
(get_range): Declare.
(check_read_access): New function.
(access_ref::access_ref): Define ctor.
(warn_string_no_nul): Add arguments. Handle -Wstrintop-overread.
(check_nul_terminated_array): Handle source strings of different
ranges of sizes.
(expand_builtin_strlen): Remove warning code, call check_read_access
instead. Declare locals closer to their initialization.
(expand_builtin_strnlen): Same.
(maybe_warn_for_bound): New function.
(warn_for_access): Remove argument. Handle -Wstrintop-overread.
(inform_access): Change argument type.
(get_size_range): New function.
(check_access): Remove unused arguments. Add new arguments. Handle
-Wstrintop-overread. Move warning code to helpers and call them.
Call check_nul_terminated_array.
(check_memop_access): Remove unnecessary and provide additional
arguments in calls.
(expand_builtin_memchr): Call check_read_access.
(expand_builtin_strcat): Remove unnecessary and provide additional
arguments in calls.
(expand_builtin_strcpy): Same.
(expand_builtin_strcpy_args): Same. Avoid testing no-warning bit.
(expand_builtin_stpcpy_1): Remove unnecessary and provide additional
arguments in calls.
(expand_builtin_stpncpy): Same.
(check_strncat_sizes): Same.
(expand_builtin_strncat): Remove unnecessary and provide additional
arguments in calls. Adjust comments.
(expand_builtin_strncpy): Remove unnecessary and provide additional
arguments in calls.
(expand_builtin_memcmp): Remove warning code. Call check_access.
(expand_builtin_strcmp): Call check_access instead of
check_nul_terminated_array.
(expand_builtin_strncmp): Handle -Wstrintop-overread.
(expand_builtin_fork_or_exec): Call check_access instead of
check_nul_terminated_array.
(expand_builtin): Same.
(fold_builtin_1): Pass additional argument.
(fold_builtin_n): Same.
(fold_builtin_strpbrk): Remove calls to check_nul_terminated_array.
(expand_builtin_memory_chk): Add comments.
(maybe_emit_chk_warning): Remove unnecessary and provide additional
arguments in calls.
(maybe_emit_sprintf_chk_warning): Same. Adjust comments.
* builtins.h (warn_string_no_nul): Add arguments.
(struct access_ref): Add member and ctor argument.
(struct access_data): Add members and ctor.
(check_access): Adjust signature.
* calls.c (maybe_warn_nonstring_arg): Return an indication of
whether a warning was issued. Issue -Wstrintop-overread instead
of -Wstringop-overflow.
(append_attrname): Adjust to naming changes.
(maybe_warn_rdwr_sizes): Same. Remove unnecessary and provide
additional arguments in calls.
* calls.h (maybe_warn_nonstring_arg): Return bool.
* doc/invoke.texi (-Wstringop-overread): Document new option.
* gimple-fold.c (gimple_fold_builtin_strcpy): Provide an additional
argument in call.
(gimple_fold_builtin_stpcpy): Same.
* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Adjust to naming
changes.
* tree.h (enum access_mode): New type.
gcc/c-family/ChangeLog:
* c.opt (Wstringop-overread): New option.
gcc/testsuite/ChangeLog:
* c-c++-common/Warray-bounds-7.c: Adjust expected warnings.
* c-c++-common/Wrestrict.c: Remove xfail.
* c-c++-common/attr-nonstring-3.c: Adjust text of expected warnings.
* c-c++-common/attr-nonstring-6.c: Suppress -Wstringop-overread
instead of -Wstringop-overflow.
* c-c++-common/attr-nonstring-8.c: Adjust text of expected warnings.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Also suppress
-Wstringop-overread.
* g++.dg/torture/Wsizeof-pointer-memaccess2.C: Same.
* gcc.dg/Warray-bounds-39.c: Adjust expected warnings.
* gcc.dg/Warray-bounds-40.c: Also suppress -Wstringop-overread.
* gcc.dg/Warray-bounds-58.c: Remove xfail. Also expect
-Wstringop-overread. Adjust text of expected warnings.
* gcc.dg/Wsizeof-pointer-memaccess1.c: Also suppress
-Wstringop-overread.
* gcc.dg/Wstringop-overflow-22.c: Adjust text of expected warnings.
* gcc.dg/Wstringop-overflow-33.c: Expect -Wstringop-overread.
* gcc.dg/Wstringop-overflow-9.c: Expect -Wstringop-overread.
* gcc.dg/attr-nonstring-2.c: Adjust text of expected warnings.
* gcc.dg/attr-nonstring-3.c: Same.
* gcc.dg/attr-nonstring-4.c: Same.
* gcc.dg/attr-nonstring.c: Expect -Wstringop-overread.
* gcc.dg/builtin-stringop-chk-5.c: Adjust comment.
* gcc.dg/builtin-stringop-chk-8.c: Enable -Wstringop-overread instead
of -Wstringop-overflow.
* gcc.dg/pr78902.c: Also expect -Wstringop-overread.
* gcc.dg/pr79214.c: Adjust text of expected warnings.
* gcc.dg/strcmpopt_10.c: Suppress valid -Wno-stringop-overread.
* gcc.dg/strlenopt-57.c: Also expect -Wstringop-overread.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Also suppress valid
-Wno-stringop-overread.
* gcc.dg/tree-ssa/builtins-folding-gimple-ub.c: Same.
* gcc.dg/uninit-33.c: Same.
* gcc.dg/warn-strnlen-no-nul-2.c: Adjust text of expected warning.
* gcc.dg/warn-strnlen-no-nul.c: Same.
* gcc.target/i386/strcmpopt_6.c: Suppress -Wstringop-overread.
* gcc.dg/Wstringop-overread-2.c: New test.
* gcc.dg/Wstringop-overread.c: New test.
Bill Schmidt [Fri, 28 Aug 2020 16:47:01 +0000 (11:47 -0500)]
rs6000: r12 copy cleanup
Remove unnecessary tests before copying function address to r12.
2020-08-28 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000.c (rs6000_call_aix): Remove test for r12.
(rs6000_sibcall_aix): Likewise.
Andrew Stubbs [Fri, 28 Aug 2020 14:41:38 +0000 (15:41 +0100)]
amdgcn: Update vec_safe_grow_cleared usage
An API change broke the amdgcn build.
gcc/ChangeLog:
* config/gcn/gcn-tree.c (gcn_goacc_get_worker_red_decl): Add "true"
parameter to vec_safe_grow_cleared.
Martin Sebor [Fri, 28 Aug 2020 14:31:50 +0000 (08:31 -0600)]
Correct calls to vec::safe_grow in conditionally compiled code.
gcc/ChangeLog:
* ggc-common.c (gt_pch_save): Add argument to a call.
gcc/jit/ChangeLog:
* jit-recording.c (recording::switch_::make_debug_string): Add argument
to a call.
Martin Sebor [Fri, 28 Aug 2020 14:26:32 +0000 (08:26 -0600)]
PR c/96596 - ICE in match_builtin_function_types on a declaration of a built-in with invalid array argument
gcc/c/ChangeLog:
PR c/96596
* c-decl.c (match_builtin_function_types): Avoid dealing with erroneous
argument type.
gcc/testsuite/ChangeLog:
PR c/96596
* gcc.dg/Wbuiltin-declaration-mismatch-16.c: New test.
Tobias Burnus [Fri, 28 Aug 2020 11:54:10 +0000 (13:54 +0200)]
Fortran: Fix absent-optional handling for nondescriptor arrays (PR94672)
gcc/fortran/ChangeLog:
PR fortran/94672
* trans-array.c (gfc_trans_g77_array): Check against the parm decl and
set the nonparm decl used for the is-present check to NULL if absent.
gcc/testsuite/ChangeLog:
PR fortran/94672
* gfortran.dg/optional_assumed_charlen_2.f90: New test.
Przemyslaw Wirkus [Fri, 28 Aug 2020 10:31:04 +0000 (11:31 +0100)]
[PATCH PR96357][GCC][AArch64]: could not split insn UNSPEC_COND_FSUB with AArch64 SVE
Problem is related to that operand 4 (In original pattern
cond_sub<mode>_any_const) is no longer the same as operand 1, and so
the pattern doesn't match the split condition.
Pattern cond_sub<mode>_any_const is being split by this patch into two
separate patterns:
* Pattern cond_sub<mode>_relaxed_const now matches const_int
SVE_RELAXED_GP operand.
* Pattern cond_sub<mode>_strict_const now matches const_int
SVE_STRICT_GP operand.
* Remove aarch64_sve_pred_dominates_p condition from both patterns.
gcc/ChangeLog:
PR target/96357
* config/aarch64/aarch64-sve.md
(cond_sub<mode>_relaxed_const): Updated and renamed from
cond_sub<mode>_any_const pattern.
(cond_sub<mode>_strict_const): New pattern.
gcc/testsuite/ChangeLog:
PR target/96357
* gcc.target/aarch64/sve/pr96357.c: New test.
Wei Wentao [Fri, 28 Aug 2020 09:43:56 +0000 (10:43 +0100)]
fix a typo in rtl.texi
gcc/
* doc/rtl.texi: Fix typo.
Alex Coplan [Fri, 28 Aug 2020 09:30:59 +0000 (10:30 +0100)]
aarch64: Disable mem-shift-canonical test on ILP32
This test fails on ILP32 since we're looking for a pattern that could
only be hit on LP64. Disabling the test on ILP32 since the problematic
mult pattern was never hit there, so there's nothing to test.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/mem-shift-canonical.c: Skip on ILP32.
Paul Thomas [Fri, 28 Aug 2020 08:02:58 +0000 (09:02 +0100)]
This patch fixes PR96624.
2020-08-28 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/96624
* simplify.c (gfc_simplify_reshape): Detect zero shape and
clear index if found.
gcc/testsuite/
PR fortran/96624
* gfortran.dg/reshape_8.f90 : New test.
Christophe Lyon [Fri, 28 Aug 2020 07:56:51 +0000 (07:56 +0000)]
testsuite: Run gcc.dg/pr96579.c only on targets with dfp support.
gcc.dg/pr96579.c includes gcc.dg/pr96370.c which needs target dfp.
2020-08-28 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
* gcc.dg/pr96579.c: Compile only with target dfp.
liuhongt [Wed, 26 Aug 2020 07:24:10 +0000 (15:24 +0800)]
Add expander for movp2hi and movp2qi.
2020-08-30 Uros Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/96744
* config/i386/i386-expand.c (split_double_mode): Also handle
E_P2HImode and E_P2QImode.
* config/i386/sse.md (MASK_DWI): New define_mode_iterator.
(mov<mode>): New expander for P2HI,P2QI.
(*mov<mode>_internal): New define_insn_and_split to split
movement of P2QI/P2HI to 2 movqi/movhi patterns after reload.
gcc/testsuite/ChangeLog:
* gcc.target/i386/double_mask_reg-1.c: New test.
liuhongt [Fri, 28 Aug 2020 07:01:18 +0000 (15:01 +0800)]
Fix: AVX512VP2INTERSECT should imply AVX512DQ.
gcc/ChangeLog
* common/config/i386/i386-common.c (ix86_handle_option): Set
AVX512DQ when AVX512VP2INTERSECT exists.
GCC Administrator [Fri, 28 Aug 2020 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Maciej W. Rozycki [Thu, 27 Aug 2020 21:02:28 +0000 (22:02 +0100)]
gotest: use a space rather than a middle dot in target lists
Replace the U+00B7 middle dot character, placed after "mips64p32le"
in the target lists, with a space. The U+00B7 character may not be
considered whitespace by Bourne shell and any non-ASCII character
may render incorrectly in some terminal devices.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/251177
Jonathan Wakely [Thu, 27 Aug 2020 21:36:03 +0000 (22:36 +0100)]
libstdc++: Make std::chrono::duration use reduced ratio for period
This implements the changes from P0548 "common_type and duration". That
was a change for C++17, but as it corrects some issues introduced by DRs
I'm also treating it as a DR and changing it for all modes from C++11
up.
The main change is that duration<R,P>::period no longer denotes P, but
rather P::type, the reduced ratio. The unary operator+ and operator-
members of duration should now return a duration using that reduced
ratio.
The requirement that common_type<T>::type is the same type as
common_type<T, T>::type (rather than simply T) was already implemented
for PR 89102.
The standard says that duration::operator+() and duration::operator-()
should return common_type_t<duration>, but that seems unnecessarily
expensive to compute. This change just uses duration<rep, period> which
is the same type, so we don't need to instantiate common_type.
As an optimization, this also adds partial specializations of
common_type for two durations of the same type, a single duration, two
time_points of the same type, and a single time_point. These
specializations avoid instantiating other specializations of common_type
and one or both of __duration_common_type or __timepoint_common_type for
the cases where the answer is trivial to obtain.
libstdc++-v3/ChangeLog:
* include/std/chrono (__duration_common_type): Ensure the
reduced ratio is used. Remove unused partial specialization
using __failure_type.
(common_type): Pass reduced ratios to __duration_common_type.
Add partial specializations for simple cases involving a single
duration or time_point type.
(duration::period): Use reduced ratio.
(duration::operator+(), duration::operator-()): Return duration
type using the reduced ratio.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc:
Adjust expected errors.
* testsuite/20_util/duration/requirements/reduced_period.cc: New test.
John David Anglin [Thu, 27 Aug 2020 19:21:22 +0000 (19:21 +0000)]
Fix shadd-2.c scan assembler count.
2020-08-27 John David Anglin <danglin@gcc.gnu.org>
gcc/testsuite/
* gcc.target/hppa/shadd-2.c: Adjust times to 4.
Patrick Palka [Thu, 27 Aug 2020 18:11:24 +0000 (14:11 -0400)]
libstdc++: Fix arithmetic bug in chrono::year_month::operator+
This fixes the months-based addition for year_month when the
year_month's month component is 0.
libstdc++-v3/ChangeLog:
* include/std/chrono (year_month::operator+): Properly handle a
month value of 0 by casting the month value to int before
subtracting 1 from it so that the difference is sign-extended in
the subsequent addition.
* testsuite/std/time/year_month/1.cc: Test adding months to a
year_month whose month component is below or above the
normalized range of [1,12].
Patrick Palka [Thu, 27 Aug 2020 18:09:52 +0000 (14:09 -0400)]
libstdc++: Fix operator overload ambiguity with calendar types
We currently don't enforce a constraint on some of the calendar types'
addition/subtraction operator overloads that take a 'months' arguments:
Constraints: If the argument supplied by the caller for the months
parameter is convertible to years, its implicit conversion sequence to
years is worse than its implicit conversion sequence to months.
This constraint is relevant when adding/subtracting a duration to/from,
say, a year_month where the given duration is convertible to both
'months' and to 'years' (as in the new testcases below). The correct
behavior here in light of this constraint is to perform the operation
through the (more efficient) 'years'-based overload, but we currently
emit an ambiguous overload error.
This patch templatizes the 'months'-based addition/subtraction operator
overloads so that in the event of an implicit-conversion tie, we select
the non-template 'years'-based overload. This is the same approach
that the date library takes for enforcing this constraint.
libstdc++-v3/ChangeLog:
* include/std/chrono
(__detail::__months_years_conversion_disambiguator): Define.
(year_month::operator+=): Templatize the 'months'-based overload
so that the 'years'-based overload is selected in case of
equally-ranked implicit conversion sequences to both 'months'
and 'years' from the supplied argument.
(year_month::operator-=): Likewise.
(year_month::operator+): Likewise.
(year_month::operator-): Likewise.
(year_month_day::operator+=): Likewise.
(year_month_day::operator-=): Likewise.
(year_month_day::operator+): Likewise.
(year_month_day::operator-): Likewise.
(year_month_day_last::operator+=): Likewise.
(year_month_day_last::operator-=): Likewise.
(year_month_day_last::operator+): Likewise
(year_month_day_last::operator-): Likewise.
(year_month_day_weekday::operator+=): Likewise
(year_month_day_weekday::operator-=): Likewise.
(year_month_day_weekday::operator+): Likewise.
(year_month_day_weekday::operator-): Likewise.
(year_month_day_weekday_last::operator+=): Likewise
(year_month_day_weekday_last::operator-=): Likewise.
(year_month_day_weekday_last::operator+): Likewise.
(year_month_day_weekday_last::operator-): Likewise.
(testsuite/std/time/year_month/2.cc): New test.
(testsuite/std/time/year_month_day/2.cc): New test.
(testsuite/std/time/year_month_day_last/2.cc): New test.
(testsuite/std/time/year_month_weekday/2.cc): New test.
(testsuite/std/time/year_month_weekday_last/2.cc): New test.
Jakub Jelinek [Thu, 27 Aug 2020 16:44:40 +0000 (18:44 +0200)]
ia32: Fix alignment of _Atomic fields [PR65146]
For _Atomic fields, lowering the alignment of long long or double etc.
fields on ia32 is undesirable, because then one really can't perform atomic
operations on those using cmpxchg8b.
The following patch stops lowering the alignment in fields for _Atomic
types (the x86_field_alignment change) and for -mpreferred-stack-boundary=2
also ensures we don't misalign _Atomic long long etc. automatic variables
(the ix86_{local,minimum}_alignment changes).
Not sure about iamcu_alignment change, I know next to nothing about IA MCU,
but unless it doesn't have cmpxchg8b instruction, it would surprise me if we
don't want to do it as well.
clang apparently doesn't lower the field alignment for _Atomic.
2020-08-27 Jakub Jelinek <jakub@redhat.com>
PR target/65146
* config/i386/i386.c (iamcu_alignment): Don't decrease alignment
for TYPE_ATOMIC types.
(ix86_local_alignment): Likewise.
(ix86_minimum_alignment): Likewise.
(x86_field_alignment): Likewise, and emit a -Wpsabi diagnostic
for it.
* gcc.target/i386/pr65146.c: New test.
Bill Schmidt [Thu, 27 Aug 2020 16:17:06 +0000 (11:17 -0500)]
rs6000: Support ELFv2 sibcall for indirect calls [PR96787]
Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls. Now that we do,
we need to be sure that r12 is set up prior to such a call.
2020-08-27 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/96787
* config/rs6000/rs6000.c (rs6000_sibcall_aix): Support
indirect call for ELFv2.
gcc/testsuite/
PR target/96787
* gcc.target/powerpc/pr96787-1.c: New.
* gcc.target/powerpc/pr96787-2.c: New.
Mark Eggleston [Fri, 21 Aug 2020 05:39:30 +0000 (06:39 +0100)]
Fortran : ICE for division by zero in declaration PR95882
A length expression containing a divide by zero in a character
declaration will result in an ICE if the constant is anymore
complicated that a contant divided by a constant.
The cause was that char_len_param_value can return MATCH_YES
even if a divide by zero was seen. Prior to returning check
whether a divide by zero was seen and if so set it to MATCH_ERROR.
2020-08-27 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/fortran
PR fortran/95882
* decl.c (char_len_param_value): Check gfc_seen_div0 and
if it is set return MATCH_ERROR.
2020-08-27 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95882
* gfortran.dg/pr95882_1.f90: New test.
* gfortran.dg/pr95882_2.f90: New test.
* gfortran.dg/pr95882_3.f90: New test.
* gfortran.dg/pr95882_4.f90: New test.
* gfortran.dg/pr95882_5.f90: New test.
Richard Biener [Thu, 27 Aug 2020 09:48:15 +0000 (11:48 +0200)]
tree-optimization/96522 - transfer of flow-sensitive info in copy_ref_info
This removes the bogus tranfer of flow-sensitive info in copy_ref_info
plus fixes one oversight in FRE when flow-sensitive non-NULLness was added to
points-to info.
2020-08-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/96522
* tree-ssa-address.c (copy_ref_info): Reset flow-sensitive
info of the copied points-to. Transfer bigger alignment
via the access type.
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
Reset all flow-sensitive info.
* gcc.dg/torture/pr96522.c: New testcase.
Martin Liska [Mon, 10 Aug 2020 09:11:05 +0000 (11:11 +0200)]
vec: add exact argument for various grow functions.
gcc/ada/ChangeLog:
* gcc-interface/trans.c (gigi): Set exact argument of a vector
growth function to true.
(Attribute_to_gnu): Likewise.
gcc/ChangeLog:
* alias.c (init_alias_analysis): Set exact argument of a vector
growth function to true.
* calls.c (internal_arg_pointer_based_exp_scan): Likewise.
* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
* cfgexpand.c (expand_asm_stmt): Likewise.
* cfgrtl.c (rtl_create_basic_block): Likewise.
* combine.c (combine_split_insns): Likewise.
(combine_instructions): Likewise.
* config/aarch64/aarch64-sve-builtins.cc (function_expander::add_output_operand): Likewise.
(function_expander::add_input_operand): Likewise.
(function_expander::add_integer_operand): Likewise.
(function_expander::add_address_operand): Likewise.
(function_expander::add_fixed_operand): Likewise.
* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
* dwarf2cfi.c (update_row_reg_save): Likewise.
* early-remat.c (early_remat::init_block_info): Likewise.
(early_remat::finalize_candidate_indices): Likewise.
* except.c (sjlj_build_landing_pads): Likewise.
* final.c (compute_alignments): Likewise.
(grow_label_align): Likewise.
* function.c (temp_slots_at_level): Likewise.
* fwprop.c (build_single_def_use_links): Likewise.
(update_uses): Likewise.
* gcc.c (insert_wrapper): Likewise.
* genautomata.c (create_state_ainsn_table): Likewise.
(add_vect): Likewise.
(output_dead_lock_vect): Likewise.
* genmatch.c (capture_info::capture_info): Likewise.
(parser::finish_match_operand): Likewise.
* genrecog.c (optimize_subroutine_group): Likewise.
(merge_pattern_info::merge_pattern_info): Likewise.
(merge_into_decision): Likewise.
(print_subroutine_start): Likewise.
(main): Likewise.
* gimple-loop-versioning.cc (loop_versioning::loop_versioning): Likewise.
* gimple.c (gimple_set_bb): Likewise.
* graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user): Likewise.
* haifa-sched.c (sched_extend_luids): Likewise.
(extend_h_i_d): Likewise.
* insn-addr.h (insn_addresses_new): Likewise.
* ipa-cp.c (gather_context_independent_values): Likewise.
(find_more_contexts_for_caller_subset): Likewise.
* ipa-devirt.c (final_warning_record::grow_type_warnings): Likewise.
(ipa_odr_read_section): Likewise.
* ipa-fnsummary.c (evaluate_properties_for_edge): Likewise.
(ipa_fn_summary_t::duplicate): Likewise.
(analyze_function_body): Likewise.
(ipa_merge_fn_summary_after_inlining): Likewise.
(read_ipa_call_summary): Likewise.
* ipa-icf.c (sem_function::bb_dict_test): Likewise.
* ipa-prop.c (ipa_alloc_node_params): Likewise.
(parm_bb_aa_status_for_bb): Likewise.
(ipa_compute_jump_functions_for_edge): Likewise.
(ipa_analyze_node): Likewise.
(update_jump_functions_after_inlining): Likewise.
(ipa_read_edge_info): Likewise.
(read_ipcp_transformation_info): Likewise.
(ipcp_transform_function): Likewise.
* ipa-reference.c (ipa_reference_write_optimization_summary): Likewise.
* ipa-split.c (execute_split_functions): Likewise.
* ira.c (find_moveable_pseudos): Likewise.
* lower-subreg.c (decompose_multiword_subregs): Likewise.
* lto-streamer-in.c (input_eh_regions): Likewise.
(input_cfg): Likewise.
(input_struct_function_base): Likewise.
(input_function): Likewise.
* modulo-sched.c (set_node_sched_params): Likewise.
(extend_node_sched_params): Likewise.
(schedule_reg_moves): Likewise.
* omp-general.c (omp_construct_simd_compare): Likewise.
* passes.c (pass_manager::create_pass_tab): Likewise.
(enable_disable_pass): Likewise.
* predict.c (determine_unlikely_bbs): Likewise.
* profile.c (compute_branch_probabilities): Likewise.
* read-rtl-function.c (function_reader::parse_block): Likewise.
* read-rtl.c (rtx_reader::read_rtx_code): Likewise.
* reg-stack.c (stack_regs_mentioned): Likewise.
* regrename.c (regrename_init): Likewise.
* rtlanal.c (T>::add_single_to_queue): Likewise.
* sched-deps.c (init_deps_data_vector): Likewise.
* sel-sched-ir.c (sel_extend_global_bb_info): Likewise.
(extend_region_bb_info): Likewise.
(extend_insn_data): Likewise.
* symtab.c (symtab_node::create_reference): Likewise.
* tracer.c (tail_duplicate): Likewise.
* trans-mem.c (tm_region_init): Likewise.
(get_bb_regions_instrumented): Likewise.
* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
(build_gimple_cfg): Likewise.
(create_bb): Likewise.
(move_block_to_fn): Likewise.
* tree-complex.c (tree_lower_complex): Likewise.
* tree-if-conv.c (predicate_rhs_code): Likewise.
* tree-inline.c (copy_bb): Likewise.
* tree-into-ssa.c (get_ssa_name_ann): Likewise.
(mark_phi_for_rewrite): Likewise.
* tree-object-size.c (compute_builtin_object_size): Likewise.
(init_object_sizes): Likewise.
* tree-predcom.c (initialize_root_vars_store_elim_1): Likewise.
(initialize_root_vars_store_elim_2): Likewise.
(prepare_initializers_chain_store_elim): Likewise.
* tree-ssa-address.c (addr_for_mem_ref): Likewise.
(multiplier_allowed_in_address_p): Likewise.
* tree-ssa-coalesce.c (ssa_conflicts_new): Likewise.
* tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
* tree-ssa-loop-ivopts.c (addr_offset_valid_p): Likewise.
(get_address_cost_ainc): Likewise.
* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
* tree-ssa-pre.c (add_to_value): Likewise.
(phi_translate_1): Likewise.
(do_pre_regular_insertion): Likewise.
(do_pre_partial_partial_insertion): Likewise.
(init_pre): Likewise.
* tree-ssa-propagate.c (ssa_prop_init): Likewise.
(update_call_from_tree): Likewise.
* tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Likewise.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
(vn_reference_lookup_pieces): Likewise.
(eliminate_dom_walker::eliminate_push_avail): Likewise.
* tree-ssa-strlen.c (set_strinfo): Likewise.
(get_stridx_plus_constant): Likewise.
(zero_length_string): Likewise.
(find_equal_ptrs): Likewise.
(printf_strlen_execute): Likewise.
* tree-ssa-threadedge.c (set_ssa_name_value): Likewise.
* tree-ssanames.c (make_ssa_name_fn): Likewise.
* tree-streamer-in.c (streamer_read_tree_bitfields): Likewise.
* tree-vect-loop.c (vect_record_loop_mask): Likewise.
(vect_get_loop_mask): Likewise.
(vect_record_loop_len): Likewise.
(vect_get_loop_len): Likewise.
* tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Likewise.
* tree-vect-slp.c (vect_slp_convert_to_external): Likewise.
(vect_bb_slp_scalar_cost): Likewise.
(vect_bb_vectorization_profitable_p): Likewise.
(vectorizable_slp_permutation): Likewise.
* tree-vect-stmts.c (vectorizable_call): Likewise.
(vectorizable_simd_clone_call): Likewise.
(scan_store_can_perm_p): Likewise.
(vectorizable_store): Likewise.
* expr.c: Likewise.
* vec.c (test_safe_grow_cleared): Likewise.
* vec.h (vec_safe_grow): Likewise.
(vec_safe_grow_cleared): Likewise.
(vl_ptr>::safe_grow): Likewise.
(vl_ptr>::safe_grow_cleared): Likewise.
* config/c6x/c6x.c (insn_set_clock): Likewise.
gcc/c/ChangeLog:
* gimple-parser.c (c_parser_gimple_compound_statement): Set exact argument of a vector
growth function to true.
gcc/cp/ChangeLog:
* class.c (build_vtbl_initializer): Set exact argument of a vector
growth function to true.
* constraint.cc (get_mapped_args): Likewise.
* decl.c (cp_maybe_mangle_decomp): Likewise.
(cp_finish_decomp): Likewise.
* parser.c (cp_parser_omp_for_loop): Likewise.
* pt.c (canonical_type_parameter): Likewise.
* rtti.c (get_pseudo_ti_init): Likewise.
gcc/fortran/ChangeLog:
* trans-openmp.c (gfc_trans_omp_do): Set exact argument of a vector
growth function to true.
gcc/lto/ChangeLog:
* lto-common.c (lto_file_finalize): Set exact argument of a vector
growth function to true.
Richard Biener [Thu, 27 Aug 2020 11:04:19 +0000 (13:04 +0200)]
streamline TARGET_MEM_REF dumping
The following streamlines TARGET_MEM_REF dumping building
on what we do for MEM_REF and thus dumping things like
access type, TBAA type and base/clique. I've changed it
to do semantic dumping aka base + offset + step * index
rather than the odd base: A, step: way.
2020-08-27 Richard Biener <rguenther@suse.de>
* tree-pretty-print.c (dump_mem_ref): Handle TARGET_MEM_REFs.
(dump_generic_node): Use dump_mem_ref also for TARGET_MEM_REF.
* gcc.dg/tree-ssa/loop-19.c: Adjust.
* gcc.dg/tree-ssa/loop-2.c: Likewise.
* gcc.dg/tree-ssa/loop-3.c: Likewise.
Alex Coplan [Thu, 27 Aug 2020 08:49:57 +0000 (09:49 +0100)]
lra: Canonicalize mult to shift in address reloads
Inside a (mem) RTX, it is canonical to write multiplications by powers
of two using a (mult) [0]. Outside of a (mem), the canonical way to
write multiplications by powers of two is using (ashift).
Now I observed that LRA does not quite respect this RTL canonicalization
rule. When compiling gcc/testsuite/gcc.dg/torture/pr34330.c with -Os
-ftree-vectorize, the RTL in the dump "281r.ira" has the insn:
(set (reg:SI 111)
(mem:SI (plus:DI (mult:DI (reg:DI 101 [ ivtmp.9 ])
(const_int 4 [0x4]))
(reg/v/f:DI 105 [ b ]))))
but LRA then proceeds to generate a reload, and we get the following
non-canonical insn in "282r.reload":
(set (reg:DI 7 x7 [121])
(plus:DI (mult:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
(const_int 4 [0x4]))
(reg/v/f:DI 1 x1 [orig:105 b ] [105])))
This patch fixes LRA to ensure that we generate canonical RTL in this
case. After the patch, we get the following insn in "282r.reload":
(set (reg:DI 7 x7 [121])
(plus:DI (ashift:DI (reg:DI 5 x5 [orig:101 ivtmp.9 ] [101])
(const_int 2 [0x2]))
(reg/v/f:DI 1 x1 [orig:105 b ] [105])))
[0] : https://gcc.gnu.org/onlinedocs/gccint/Insn-Canonicalizations.html
gcc/ChangeLog:
* lra-constraints.c (canonicalize_reload_addr): New.
(curr_insn_transform): Use canonicalize_reload_addr to ensure we
generate canonical RTL for an address reload.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/mem-shift-canonical.c: New test.
xiezhiheng [Thu, 27 Aug 2020 08:07:26 +0000 (09:07 +0100)]
AArch64: Add FLAG for rounding intrinsics [PR94442]
2020-08-27 Zhiheng Xie <xiezhiheng@huawei.com>
gcc/ChangeLog:
* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
for rounding intrinsics.
xiezhiheng [Thu, 27 Aug 2020 08:07:26 +0000 (09:07 +0100)]
AArch64: Add FLAG for min/max intrinsics [PR94442]
2020-08-27 Zhiheng Xie <xiezhiheng@huawei.com>
gcc/ChangeLog:
* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
for min/max intrinsics.
Richard Biener [Thu, 27 Aug 2020 08:02:22 +0000 (10:02 +0200)]
tree-optimization/96579 - another special-operands fix in reassoc
This makes sure to put special-ops expanded rhs left where
expression rewrite expects it.
2020-08-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/96579
* tree-ssa-reassoc.c (linearize_expr_tree): If we expand
rhs via special ops make sure to swap operands.
* gcc.dg/pr96579.c: New testcase.
Richard Biener [Wed, 26 Aug 2020 06:44:59 +0000 (08:44 +0200)]
tree-optimization/96565 - improve DSE with paths ending in noreturn
This improves DSEs stmt walking by not considering a DEF without
uses for further processing (and thus giving up when there's two
paths to follow).
2020-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/96565
* tree-ssa-dse.c (dse_classify_store): Remove defs with
no uses from further processing.
* gcc.dg/tree-ssa/ssa-dse-40.c: New testcase.
* gcc.dg/builtin-object-size-4.c: Adjust.
Patrick Palka [Thu, 27 Aug 2020 01:51:48 +0000 (21:51 -0400)]
libstdc++: Implement remaining piece of LWG 3448
Almost all of the proposed resolution for LWG 3448 is already
implemented; the only part left is to adjust the return type of
transform_view::sentinel::operator-.
libstdc++-v3/ChangeLog:
PR libstdc++/95322
* include/std/ranges (transform_view::sentinel::__distance_from):
Give this a deduced return type.
(transform_view::sentinel::operator-): Adjust the return type so
that it's based on the constness of the iterator rather than
that of the sentinel.
* testsuite/std/ranges/adaptors/95322.cc: Refer to LWG 3488.
Patrick Palka [Thu, 27 Aug 2020 01:52:58 +0000 (21:52 -0400)]
libstdc++: elements_view's sentinel and iterator not comparable [LWG 3406]
This implements the proposed resolution for LWG 3406, and adds a
testcase for the example from P1994R1.
libstdc++-v3/ChangeLog:
* include/std/ranges (elements_view::begin): Adjust constraints.
(elements_view::end): Likewise.
(elements_view::_Sentinel::operator==): Templatize to take both
_Iterator<true> and _Iterator<false>.
(elements_view::_Sentinel::operator-): Likewise.
* testsuite/std/ranges/adaptors/elements.cc: Add testcase for
the example from P1994R1.
* testsuite/std/ranges/adaptors/lwg3406.cc: New test.
Patrick Palka [Thu, 27 Aug 2020 01:49:51 +0000 (21:49 -0400)]
libstdc++: Implement P1994R1 changes to ranges::elements_view
The example from the paper doesn't compile without the proposed
resolution for LWG 3406, so we'll add a testcase for this once the
proposed resolution is implemented.
libstdc++-v3/ChangeLog:
* include/std/ranges (elements_view::end): Replace these two
overloads with four new overloads.
(elements_view::_Iterator::operator==): Remove.
(elements_view::_Iterator::operator-): Likewise.
(elements_view::_Sentinel): Define.
GCC Administrator [Thu, 27 Aug 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Clément Chigot [Wed, 26 Aug 2020 08:19:23 +0000 (10:19 +0200)]
cmd: add -maix32 to gcc calls for aix/ppc
As gcc might now be compiled in 64bit, -maix32 must always be added
to ensure that created objects will be 32bit.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250778
Clément Chigot [Wed, 26 Aug 2020 08:08:48 +0000 (10:08 +0200)]
libgo: add FAT library support for static libraries on AIX
Like shared libraries, AIX static libraries must also have both 32 and
64 bit objects.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/250777
Jeff Law [Wed, 26 Aug 2020 23:12:07 +0000 (17:12 -0600)]
Mark various tests that require a c99 libm
A number of i386 math optimisation tests are looking assembly instructions
that are only emitted when the compiler knows the target has a C99 libm
available. Since targets like *-elf may not have such a libm, a C99 runtime
requirement is added to these tests.
gcc/testsuite/ChangeLog
* gcc.target/i386/387-7.c: Add dg-require-effective-target c99_runtime.
* gcc.target/i386/387-9.c: Likewise.
* g++.target/i386/avx512bw-pr96246-1.C: Likewise.
* gcc.target/i386/avx512f-rint-sfix-vec-2.c: Likewise.
* gcc.target/i386/avx512f-rintf-sfix-vec-2.c: Likewise.
* g++.target/i386/avx512vl-pr96246-1.C: Likewise.
* gcc.target/i386/pr61403.c: Likewise.
* gcc.target/i386/sse4_1-ceil-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-ceilf-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-floor-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-floorf-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-rint-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-rintf-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-round-sfix-vec.c: Likewise.
* gcc.target/i386/sse4_1-roundf-sfix-vec.c: Likewise.
Göran Uddeborg [Wed, 26 Aug 2020 23:06:28 +0000 (17:06 -0600)]
Fix documentation of -fprofile-exclude-files
The wording of the description of -fprofile-exclude-files is easy to
misunderstand. One can be led to believe a file is excluded only if
it matches all of the patterns, not just one. This patch tries to
clarify the function. It also adjusts the wording of
-fprofile-filter-files accordingly.
gcc/
PR gcov-profile/96285
* common.opt, doc/invoke.texi: Clarify wording of
-fprofile-exclude-files and adjust -fprofile-filter-files to
match.
H.J. Lu [Wed, 26 Aug 2020 19:37:05 +0000 (12:37 -0700)]
x86: Reject target("no-general-regs-only")
Reject target("no-general-regs-only") pragma and attribute.
gcc/
PR target/96802
* config/i386/i386-options.c (ix86_valid_target_attribute_inner_p):
Reject target("no-general-regs-only").
gcc/testsuite/
PR target/96802
* gcc.target/i386/pr96802-1.c: New test.
* gcc.target/i386/pr96802-2.c: Likewise.
Jozef Lawrynowicz [Wed, 26 Aug 2020 19:50:58 +0000 (20:50 +0100)]
MSP430: Simplify and extend shift instruction patterns
The implementation of define_expand and define_insn patterns to handle
shifts in the MSP430 backend is inconsistent, resulting in missed
opportunities to make best use of the architecture's features.
There's now a single define_expand used as the entry point for all valid
shifts, and the decision to either use a helper function to perform the
shift (often required for the 430 ISA), or fall through to the
define_insn patterns can be made from that expander function.
Shifts by a constant amount have been grouped into one define_insn for
each type of shift, instead of having different define_insn patterns for
shifts by different amounts.
A new target option "-mmax-inline-shift=" has been added to allow tuning
of the number of shift instructions to emit inline, instead of using
a library helper function.
gcc/ChangeLog:
* config/msp430/constraints.md (K): Change unused constraint to
constraint to a const_int between 1 and 19.
(P): New constraint.
* config/msp430/msp430-protos.h (msp430x_logical_shift_right): Remove.
(msp430_expand_shift): New.
(msp430_output_asm_shift_insns): New.
* config/msp430/msp430.c (msp430_rtx_costs): Remove shift costs.
(CSH): Remove.
(msp430_expand_helper): Remove hard-coded generation of some inline
shift insns.
(use_helper_for_const_shift): New.
(msp430_expand_shift): New.
(msp430_output_asm_shift_insns): New.
(msp430_print_operand): Add new 'W' operand selector.
(msp430x_logical_shift_right): Remove.
* config/msp430/msp430.md (HPSI): New define_mode_iterator.
(HDI): Likewise.
(any_shift): New define_code_iterator.
(shift_insn): New define_code_attr.
Adjust unnamed insn patterns searched for by combine.
(ashlhi3): Remove.
(slli_1): Remove.
(430x_shift_left): Remove.
(slll_1): Remove.
(slll_2): Remove.
(ashlsi3): Remove.
(ashldi3): Remove.
(ashrhi3): Remove.
(srai_1): Remove.
(430x_arithmetic_shift_right): Remove.
(srap_1): Remove.
(srap_2): Remove.
(sral_1): Remove.
(sral_2): Remove.
(ashrsi3): Remove.
(ashrdi3): Remove.
(lshrhi3): Remove.
(srli_1): Remove.
(430x_logical_shift_right): Remove.
(srlp_1): Remove.
(srll_1): Remove.
(srll_2x): Remove.
(lshrsi3): Remove.
(lshrdi3): Remove.
(<shift_insn><mode>3): New define_expand.
(<shift_insn>hi3_430): New define_insn.
(<shift_insn>si3_const): Likewise.
(ashl<mode>3_430x): Likewise.
(ashr<mode>3_430x): Likewise.
(lshr<mode>3_430x): Likewise.
(*bitbranch<mode>4_z): Replace renamed predicate msp430_bitpos with
const_0_to_15_operand.
* config/msp430/msp430.opt: New option -mmax-inline-shift=.
* config/msp430/predicates.md (const_1_to_8_operand): New predicate.
(const_0_to_15_operand): Rename msp430_bitpos predicate.
(const_1_to_19_operand): New predicate.
* doc/invoke.texi: Document -mmax-inline-shift=.
libgcc/ChangeLog:
* config/msp430/slli.S (__gnu_mspabi_sllp): New.
* config/msp430/srai.S (__gnu_mspabi_srap): New.
* config/msp430/srli.S (__gnu_mspabi_srlp): New.
gcc/testsuite/ChangeLog:
* gcc.target/msp430/emulate-srli.c: Fix expected assembler text.
* gcc.target/msp430/max-inline-shift-430-no-opt.c: New test.
* gcc.target/msp430/max-inline-shift-430.c: New test.
* gcc.target/msp430/max-inline-shift-430x.c: New test.
Jonathan Wakely [Wed, 26 Aug 2020 18:32:30 +0000 (19:32 +0100)]
libstdc++: Whitespace changes in <tuple>
libstdc++-v3/ChangeLog:
* include/std/tuple (_Tuple_impl): Whitespaces changes for
consistent indentation. Also use __enable_if_t alias template.
Jonathan Wakely [Wed, 26 Aug 2020 18:32:30 +0000 (19:32 +0100)]
libstdc++: Use correct argument type for __use_alloc [PR 96803]
The _Tuple_impl constructor for allocator-extended construction from a
different tuple type uses the _Tuple_impl's own _Head type in the
__use_alloc test. That is incorrect, because the argument tuple could
have a different type. Using the wrong type might select the
leading-allocator convention when it should use the trailing-allocator
convention, or vice versa.
libstdc++-v3/ChangeLog:
PR libstdc++/96803
* include/std/tuple
(_Tuple_impl(allocator_arg_t, Alloc, const _Tuple_impl<U...>&)):
Replace parameter pack with a type parameter and a pack and pass
the first type to __use_alloc.
* testsuite/20_util/tuple/cons/96803.cc: New test.
Patrick Palka [Wed, 26 Aug 2020 16:45:02 +0000 (12:45 -0400)]
libstdc++: Fix typo in chrono::year_month_weekday::operator==
libstdc++-v3/ChangeLog:
* include/std/chrono (year_month_weekday::operator==): Compare
weekday_indexed instead of weekday.
* testsuite/std/time/year_month_weekday/1.cc: Augment testcase.
Jonathan Wakely [Wed, 26 Aug 2020 16:30:31 +0000 (17:30 +0100)]
libstdc++: Fix regression in hash containers
A recent change altered the layout of EBO-helper base classes, resulting
in an ambiguity when the hash function and equality predicate are the
same type.
This modifies the type of one of the base classes, so that we don't get
two base classes of the same type.
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h (_Hash_code_base): Change
index of _Hashtable_ebo_helper base class.
* testsuite/23_containers/unordered_map/dup_types.cc: New test.
Tobias Burnus [Wed, 26 Aug 2020 15:55:36 +0000 (17:55 +0200)]
MAINTAINERS: Add myself as OpenACC maintainer
ChangeLog:
* MAINTAINERS (Various Maintainers): Add myself as OpenACC maintainer.
Aldy Hernandez [Tue, 4 Aug 2020 04:50:38 +0000 (06:50 +0200)]
Adjust tree-ssa-dom.c for irange API.
This removes all uses of VR_ANTI_RANGE.
gcc/ChangeLog:
* tree-ssa-dom.c (simplify_stmt_for_jump_threading): Abstract code out to...
* tree-vrp.c (find_case_label_range): ...here. Rewrite for to use irange
API.
(simplify_stmt_for_jump_threading): Call find_case_label_range instead of
duplicating the code in simplify_stmt_for_jump_threading.
* tree-vrp.h (find_case_label_range): New prototype.
Richard Biener [Wed, 26 Aug 2020 13:12:17 +0000 (15:12 +0200)]
tree-optimization/96698 - fix ICE when vectorizing nested cycles
This fixes vectorized PHI latch edge updating and delay it until
all of the loop is code generated to deal with the case that the
latch def is a PHI in the same block.
2020-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/96698
* tree-vectorizer.h (loop_vec_info::reduc_latch_defs): New.
(loop_vec_info::reduc_latch_slp_defs): Likewise.
* tree-vect-stmts.c (vect_transform_stmt): Only record
stmts to update PHI latches from, perform the update ...
* tree-vect-loop.c (vect_transform_loop): ... here after
vectorizing those PHIs.
(info_for_reduction): Properly handle non-reduction PHIs.
* gcc.dg/vect/pr96698.c: New testcase.
Jonathan Wakely [Wed, 26 Aug 2020 13:47:51 +0000 (14:47 +0100)]
libstdc++: Enable assertions in constexpr string_view members [PR 71960]
Since GCC 6.1 there is no reason we can't just use __glibcxx_assert in
constexpr functions in string_view. As long as the condition is true,
there will be no call to std::__replacement_assert that would make the
function ineligible for constant evaluation.
PR libstdc++/71960
* include/experimental/string_view (basic_string_view):
Enable debug assertions.
* include/std/string_view (basic_string_view):
Likewise.
Martin Liska [Wed, 26 Aug 2020 11:18:14 +0000 (13:18 +0200)]
symver: fix attribute matching.
gcc/ChangeLog:
* cgraphunit.c (process_symver_attribute): Match only symver
TREE_PURPOSE.
Patrick Palka [Wed, 26 Aug 2020 13:35:07 +0000 (09:35 -0400)]
libstdc++: Add missing extra space to ChangeLog author lines
Patrick Palka [Wed, 26 Aug 2020 13:29:39 +0000 (09:29 -0400)]
libstdc++: Add missing coauthors to ChangeLog entry
The corresponding commit had the Co-authored-by: lines in the middle of
the commit message instead of at the end, so the ChangeLog script didn't
consider them.
Richard Biener [Wed, 26 Aug 2020 12:24:01 +0000 (14:24 +0200)]
tree-optimization/96783 - fix vectorization of negative step SLP
This appropriately uses VMAT_ELEMENTWISE when the vectors cannot be
filled from a single SLP group until we get more explicit support
for negative stride SLP.
2020-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/96783
* tree-vect-stmts.c (get_group_load_store_type): Use
VMAT_ELEMENTWISE for negative strides when we cannot
use VMAT_STRIDED_SLP.
* gcc.dg/vect/pr96783-1.c: New testcase.
* gcc.dg/vect/pr96783-2.c: Likewise.
Nathan Sidwell [Tue, 25 Aug 2020 19:35:07 +0000 (12:35 -0700)]
c++: template operator lookup caching
Jason's fix to retain operator lookups inside dependent lambda
functions turns out to be needed on the modules branch for all
template functions. Because the context for that lookup no longer
exists in imports. There were also a couple of shortcomings, which
this patch fixes.
(a) we conflate 'we found nothing' and 'we can redo this at
instantiation time'. Fixed by making the former produce
error_mark_node. That needs a fix in name-lookup to know that finding
a binding containing error_mark_node, means 'stop looking' you found
nothing.
(b) we'd continually do lookups for every operator, if nothing needed
to be retained. Fixed by always caching that information, and then
dealing with it when pushing the bindings.
(c) if what we found was that find by a global namespace lookup, we'd
not cache that. But that'd cause us to either find decls declared
after the template, potentially hiding those we expected to find. So
don't do that check.
This still retains only recording on lambdas. As the comment says, we
could enable for all templates.
gcc/cp/
* decl.c (poplevel): A local-binding tree list holds the name in
TREE_PURPOSE.
* name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
(lookup_name_1): Deal with local-binding error_mark_node marker.
(op_unqualified_lookup): Return error_mark_node for 'nothing
found'. Retain global binding, check class binding here.
(maybe_save_operator_binding): Reimplement to always cache a
result.
(push_operator_bindings): Deal with 'ignore' marker.
gcc/testsuite/
* g++.dg/lookup/operator-1.C: New.
* g++.dg/lookup/operator-2.C: New.
Martin Liska [Wed, 26 Aug 2020 08:10:39 +0000 (10:10 +0200)]
lto: fix documentation about -fpie and -fpic options
gcc/ChangeLog:
* doc/invoke.texi: Document how are pie and pic options merged.
xiezhiheng [Wed, 26 Aug 2020 10:12:56 +0000 (11:12 +0100)]
AArch64: Add FLAG for add/sub arithmetic intrinsics [PR94442]
2020-08-26 Zhiheng Xie <xiezhiheng@huawei.com>
gcc/ChangeLog:
* config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
for add/sub arithmetic intrinsics.
Qian Jianhua [Wed, 26 Aug 2020 10:08:10 +0000 (11:08 +0100)]
aarch64: Fix testcase gcc.target/aarch64/insv_1.c
There are three failures in gcc.target/aarch64/insv_1.c.
FAIL: gcc.target/aarch64/insv_1.c scan-assembler bfi\tx[0-9]+, x[0-9]+, 0, 8
FAIL: gcc.target/aarch64/insv_1.c scan-assembler bfi\tx[0-9]+, x[0-9]+, 16, 5
FAIL: gcc.target/aarch64/insv_1.c scan-assembler movk\tx[0-9]+, 0x1d6b, lsl 32
This patch fix the third failure which was missed "#" before immediate value
in scan-assembler.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/insv_1.c: Add '#' in scan-assembler
Jakub Jelinek [Wed, 26 Aug 2020 08:30:15 +0000 (10:30 +0200)]
dwarf2out: Fix up dwarf2out_next_real_insn caching [PR96729]
The addition of NOTE_INSN_BEGIN_STMT and NOTE_INSN_INLINE_ENTRY notes
reintroduced quadratic behavior into dwarf2out_var_location.
This function needs to know the next real instruction to which the var
location note applies, but the way final_scan_insn is called outside of
final.c main loop doesn't make it easy to look up the next real insn in
there (and for non-dwarf it is even useless). Usually next real insn is
only a few notes away, but we can have hundreds of thousands of consecutive
notes only followed by a real insn. dwarf2out_var_location to avoid the
quadratic behavior contains a cache, it remembers the next note and when it
is called again on that loc_note, it can use the previously computed
dwarf2out_next_real_insn result, rather than walking the insn chain once
again. But, for NOTE_INSN_{BEGIN_STMT,INLINE_ENTRY} dwarf2out_var_location
is not called while the code puts into the cache those notes, which means if
we have e.g. in the worst case NOTE_INSN_VAR_LOCATION and
NOTE_INSN_BEGIN_STMT notes alternating, the cache is not really used.
The following patch fixes it by looking up the next NOTE_INSN_VAR_LOCATION
if any. While the lookup could be perhaps done together with looking for
the next real insn once (e.g. in dwarf2out_next_real_insn or its copy),
there are other dwarf2out_next_real_insn callers which don't need/want that
behavior and if there are more than two NOTE_INSN_VAR_LOCATION notes
followed by the same real insn, we need to do that "find next
NOTE_INSN_VAR_LOCATION" walk anyway.
On the testcase from the PR this patch speeds it 2.8times, from 0m0.674s
to 0m0.236s (why it takes for the reporter more than 60s is unknown).
2020-08-26 Jakub Jelinek <jakub@redhat.com>
PR debug/96729
* dwarf2out.c (dwarf2out_next_real_insn): Adjust function comment.
(dwarf2out_var_location): Look for next_note only if next_real is
non-NULL, in that case look for the first non-deleted
NOTE_INSN_VAR_LOCATION between loc_note and next_real, if any.
Iain Buclaw [Tue, 4 Aug 2020 16:11:51 +0000 (18:11 +0200)]
libiberty: Add support for `in' and `in ref' storage classes.
The storage class `in' is now a first-class citizen with its own mangle
symbol, of which also permits `in ref'. Previously, `in' was an alias
to `const [scope]', which is a type constructor.
The mangle symbol repurposed for this is `I', which was originally used
by identifier types. However, while TypeIdentifier is part of the
grammar, it must be resolved to some other entity during the semantic
passes, and so shouldn't appear anywhere in the mangled name.
Old tests that are now no longer valid have been removed.
libiberty/ChangeLog:
* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
parameter storage classes.
(dlang_type): Remove identifier type.
* testsuite/d-demangle-expected: Update tests.
Iain Buclaw [Tue, 25 Aug 2020 20:13:52 +0000 (22:13 +0200)]
d: Merge upstream dmd
e49192807
1. Removes prelude assert for constructors and destructors. To trigger
these asserts one needed to construct or destruct an aggregate at the
null memory location. This would crash upon any data member access,
which is required for a constructor or destructor to do anything useful.
2. Disables bounds checking in foreach statements, when the array is
either a static or dynamic array. If we trust the array `.length' to
be correct, then all elements are between `[0 .. length]', and can't
can't be out of bounds.
Reviewed-on: https://github.com/dlang/dmd/pull/11623
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
e49192807
Iain Buclaw [Fri, 24 Jul 2020 16:06:51 +0000 (18:06 +0200)]
d: Fix no RVO when returning struct literals initialized with constructor.
Backports a change from upstream dmd that moves front-end NRVO checking
from ReturnStatement semantic to the end of FuncDeclaration semantic.
In the codegen, retStyle has been partially implemented so that only
structs and static arrays return RETstack. This isn't accurate, but
don't need to be for the purposes of semantic analysis.
If a function either has TREE_ADDRESSABLE or must return in memory, then
DECL_RESULT is set as the shidden field for the function. This is used
in the codegen pass for ReturnStatement where it is now detected whether
a function is returning a struct literal or a constructor function, then
the DECL_RESULT is used to directly construct the return value, instead
of doing so via temporaries.
Reviewed-on: https://github.com/dlang/dmd/pull/11622
gcc/d/ChangeLog:
PR d/96156
* d-frontend.cc (retStyle): Only return RETstack for struct and static
array types.
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Use NRVO return
for all TREE_ADDRESSABLE types. Set shidden to the RESULT_DECL.
* expr.cc (ExprVisitor::visit (CallExp *)): Force TARGET_EXPR if the
'this' pointer reference is a CONSTRUCTOR.
(ExprVisitor::visit (StructLiteralExp *)): Generate assignment to the
symbol to initialize with literal.
* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returning
struct literals and write directly into the RESULT_DECL.
* dmd/MERGE: Merge upstream dmd
fe5f388d8.
gcc/testsuite/ChangeLog:
PR d/96156
* gdc.dg/pr96156.d: New test.
Iain Buclaw [Tue, 25 Aug 2020 09:56:18 +0000 (11:56 +0200)]
tilepro: Update generator file to define IN_TARGET_CODE in target file.
The target files tilegx/mul-tables.c and tilepri/mul-tables.c were
updated in SVN r255743, but the generator file that produces them
wasn't, so it was reverting this change during builds.
gcc/ChangeLog:
* config/tilepro/gen-mul-tables.cc (main): Define IN_TARGET_CODE to 1
in the target file.
Iain Buclaw [Tue, 25 Aug 2020 09:54:16 +0000 (11:54 +0200)]
contrib: Add OPT-enable-obsolete to tile*-*-*
The tile*-*-* targets were marked as obsolete in SVN r259724.
contrib/ChangeLog:
* config-list.mk (LIST): Add OPT-enable-obsolete to tilegx-linux-gnu,
tilegxbe-linux-gnu, and tilepro-linux-gnu.
Iain Buclaw [Tue, 25 Aug 2020 09:44:48 +0000 (11:44 +0200)]
d: Merge upstream dmd
cb4a96fae
Fixes both a bug where compilation would hang, and an issue where recursive
template limits are hit too early.
Reviewed-on: https://github.com/dlang/dmd/pull/11621
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
cb4a96fae
Iain Buclaw [Tue, 25 Aug 2020 09:23:24 +0000 (11:23 +0200)]
d: Use read() to load contents of stdin into memory.
This would be an improvement over reading one character at a time.
An ICE was discovered when mixing reading from stdin with `-v', this has been
fixed in upstream DMD and backported as well.
Reviewed-on: https://github.com/dlang/dmd/pull/11620
gcc/d/ChangeLog:
* d-lang.cc (d_parse_file): Use read() to load contents from stdin,
allow the front-end to free the memory after parsing.
* dmd/MERGE: Merge upstream dmd
2cc25c219.
Iain Buclaw [Tue, 25 Aug 2020 09:05:57 +0000 (11:05 +0200)]
d: Fix small struct literals that have non-deterministic hash values
Same issue as the initial commit that addressed PR96153, only this time to fix
it also for structs that are not returned in memory. Tests have been added
that triggered an assertion on x86_64, however the original test was failing
on SPARC 64-bit targets.
gcc/d/ChangeLog:
PR d/96153
* d-codegen.cc (build_address): Create a temporary for CALL_EXPRs
returning trivial aggregates, pre-filling it with zeroes.
(build_memset_call): Use build_zero_cst if setting the entire object.
gcc/testsuite/ChangeLog:
PR d/96153
* gdc.dg/pr96153.d: Add new tests.
Iain Buclaw [Mon, 24 Aug 2020 22:39:17 +0000 (00:39 +0200)]
d: Fix no NRVO when returning an array of a non-POD struct
TREE_ADDRESSABLE was not propagated from the RECORD_TYPE to the ARRAY_TYPE, so
NRVO code generation was not being triggered.
gcc/d/ChangeLog:
PR d/96157
* d-codegen.cc (d_build_call): Handle TREE_ADDRESSABLE static arrays.
* types.cc (make_array_type): Propagate TREE_ADDRESSABLE from base
type to static array.
gcc/testsuite/ChangeLog:
PR d/96157
* gdc.dg/pr96157a.d: New test.
* gdc.dg/pr96157b.d: New test.
Iain Buclaw [Mon, 24 Aug 2020 22:28:38 +0000 (00:28 +0200)]
d: Don't run all permutations for fail_compilation tests.
Fail compilation tests only check for language errors from the front-end, all
default option switches do nothing to alter the error.
gcc/testsuite/ChangeLog:
* lib/gdc-utils.exp (gdc-convert-test): Clear PERMUTE_ARGS for
fail_compilation tests if not set by test file.
Iain Buclaw [Fri, 21 Aug 2020 10:24:20 +0000 (12:24 +0200)]
d: Move lowering of each tree node to separate functions
gcc/d/ChangeLog:
* d-gimplify.cc (d_gimplify_expr): Move lowering of each tree node to
separate functions.
(d_gimplify_modify_expr): New function.
(d_gimplify_addr_expr): New function.
(d_gimplify_call_expr): New function.
(d_gimplify_unsigned_rshift_expr): New function.
Iain Buclaw [Fri, 21 Aug 2020 09:58:51 +0000 (11:58 +0200)]
d: Move d_gimplify_expr and dependencies to d-gimplify.cc
gcc/d/ChangeLog:
* Make-lang.in (D_OBJS): Add d-gimplify.o.
* d-lang.cc (empty_modify_p): Move to d-gimplify.cc.
(d_gimplify_expr): Likewise.
* d-tree.h (d_gimplify_expr): Declare.
* d-gimplify.cc: New file.
Martin Liska [Mon, 24 Aug 2020 11:21:10 +0000 (13:21 +0200)]
IPA symver: allow multiple symvers for a definition
gcc/ChangeLog:
* cgraphunit.c (process_symver_attribute): Allow multiple
symver attributes for one symbol.
* doc/extend.texi: Document the change.
gcc/testsuite/ChangeLog:
* lib/target-supports-dg.exp: Add dg-require-symver.
* lib/target-supports.exp: Likewise.
* gcc.dg/ipa/symver1.c: New test.
Tobias Burnus [Wed, 26 Aug 2020 07:32:40 +0000 (09:32 +0200)]
Fortran: Add 'device_type' clause to OpenMP's declare target
gcc/fortran/ChangeLog:
* gfortran.h (enum gfc_omp_device_type): New.
(symbol_attribute, gfc_omp_clauses, gfc_common_head): Use it.
* module.c (enum ab_attribute): Add AB_OMP_DEVICE_TYPE_HOST,
AB_OMP_DEVICE_TYPE_NOHOST and AB_OMP_DEVICE_TYPE_ANY.
(attr_bits, mio_symbol_attribute): Handle it.
(load_commons, write_common_0): Handle omp_device_type flag.
* openmp.c (enum omp_mask1): Add OMP_CLAUSE_DEVICE_TYPE
(OMP_DECLARE_TARGET_CLAUSES): Likewise.
(gfc_match_omp_clauses): Match 'device_type'.
(gfc_match_omp_declare_target): Handle it.
* trans-common.c (build_common_decl): Write device-type clause.
* trans-decl.c (add_attributes_to_decl): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/declare-target-4.f90: New test.
* gfortran.dg/gomp/declare-target-5.f90: New test.
François Dumont [Mon, 20 Jan 2020 07:21:10 +0000 (08:21 +0100)]
libstdc++: Rename _Hashtable _H1, _H2 and _Hash template parameters
Limit our _Hashtable implementation to ranged hash. _H1 is now rename
to _Hash matching the _Hash functor used for unordered containers. _H2
is now renamed to _RangeHash. Former _Hash simply becomes _Unused. Remove
_ExtractKey storage.
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h (_Hashtable<>): Rename _H1 into _Hash
_H2 into _RangeHash and _Hash into _Unused.
(_Hastable_base<>): Likewise.
(_Map_base<>): Likewise.
(_Insert_base<>): Likewise.
(_Insert<>): Likewise.
(_Rehash_base<>): Likewise.
(_Local_iterator_base<>): Likewise.
(_Hash_code_base<>): Likewise.
(_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>):
Remove.
(_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>):
Remove.
(_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHas, _Unused,
bool>): Remove _Hashtable_ebo_helper<2, _RangeHash> base type..
(_Hash_code_base<>::_M_bucket_index(const _Key&, __hash_code, size_t)):
Replace by...
(_Hash_code_base<>::_M_bucket_index(__hash_code, size_t)): ...this.
(_Local_iterator<>): Remove _H1 and _H2 template parameters.
(_Local_const_iterator<>): Likewise.
(_Equality<>): Likewise.
(_Map_base<>::operator[](const key_type&): Adapt.
(_Map_base<>::operator[](key_type&&): Adapt.
(_Identity::operator()): Add noexcept.
(_Select1st::operator()): Likewise.
(_Hash_code_base<>): Remove _Hashtable_ebo_helper<0, _ExtractKey> base
type.
(_Hash_code_base::_M_extract): Remove.
* include/bits/hashtable.h (_Hashtable<>): Remove _H1 and _H2 template
parameters. Remove _ExtractKey from constructors.
(_Hashtable<>::_M_insert_unique_node(const key_type&, size_t,
__hash_code, __node_type*, size_t)): Replace by...
(_Hashtable<>::_M_insert_unique_node(size_t, __hash_code,
__node_type*, size_t)): ...this.
(_Hashtable<>::_M_insert_muti_node(__node_type*, const key_type&,
__hash_code, __node_type*)): Replace by...
(_Hashtable<>::_M_insert_multi_node(__node_type*, __hash_code,
__node_type*)): ...this.
(_Hashtable<>::__key_extract): Remove.
* include/bits/node_handle.h: Adapt.
liuhongt [Tue, 18 Aug 2020 07:06:01 +0000 (15:06 +0800)]
Adjust testcase.
Rewriting testcase with cpp source file, then compare operator could
be used directly for vector, this would avoid impact of vectorizer.
gcc/testsuite/ChangeLog:
PR target/96667
* gcc.target/i386/avx512bw-pr96246-1.c: Moved to...
* g++.target/i386/avx512bw-pr96246-1.C: ...here.
* gcc.target/i386/avx512bw-pr96246-2.c: Moved to...
* g++.target/i386/avx512bw-pr96246-2.C: ...here.
* gcc.target/i386/avx512vl-pr96246-1.c: Moved to...
* g++.target/i386/avx512vl-pr96246-1.C: ...here.
* gcc.target/i386/avx512vl-pr96246-2.c: Moved to...
* g++.target/i386/avx512vl-pr96246-2.C: ...here.
David Malcolm [Fri, 21 Aug 2020 22:34:16 +0000 (18:34 -0400)]
analyzer: fix leak false positive/widening on pointer iteration [PR94858]
PR analyzer/94858 reports a false diagnostic from
-Wanalyzer-malloc-leak, where the allocated pointer is pointed to by a
field of a struct, and a loop writes to a buffer, writing through an
iterating pointer value.
There were several underlying problems, relating to clobbering of the
struct holding the malloc-ed pointer; in each case the analyzer was
conservatively assuming that a write could affect this region,
clobbering it to "unknown", and this was detected as a leak.
The initial write within the loop dereferences the initial value of
a field, and the analyzer was assuming that that pointer could
point to the result of the malloc call. The patch extends
store::eval_alias_1 so that it "knows" that the initial value of a
pointer at the beginning of a path can't point to a region that was
allocated on the heap after the beginning of the path.
On fixing that, the next issue is that within the loop the iterated
pointer value becomes "unknown", and hence *ptr becomes a write to a
symbolic region, and thus might clobber the struct (which it can't).
This patch adds enough logic to svalue::can_merge_p to merge the
iterating pointer value so that at the 2nd iteration analyzing
the loop it becomes a widening_svalue from the initial svalue, so
that this becomes a fixed point of the analysis, and is not an
unknown_svalue. The patch further extends store::eval_alias_1 so that
it "knows" that this widening_svalue can only point to the same base
region as the initial value did; in particular, symbolic writes through
this pointer can only clobber that base region, not the struct holding
the malloc-ed pointer.
gcc/analyzer/ChangeLog:
PR analyzer/94858
* region-model-manager.cc
(region_model_manager::get_or_create_widening_svalue): Assert that
neither of the inputs are themselves widenings.
* store.cc (store::eval_alias_1): The initial value of a pointer
can't point to a region that was allocated on the heap after the
beginning of the path. A widened pointer value can't alias anything
that the initial pointer value can't alias.
* svalue.cc (svalue::can_merge_p): Merge BINOP (X, OP, CST) with X
to a widening svalue. Merge
BINOP(WIDENING(BASE, BINOP(BASE, X)), X) and BINOP(BASE, X) to
to the LHS of the first BINOP.
gcc/testsuite/ChangeLog:
PR analyzer/94858
* gcc.dg/analyzer/loop-start-up-to-end-by-1.c: Remove xfail.
* gcc.dg/analyzer/pr94858-1.c: New test.
* gcc.dg/analyzer/pr94858-2.c: New test.
* gcc.dg/analyzer/torture/loop-inc-ptr-2.c: Update expected number
of enodes.
* gcc.dg/analyzer/torture/loop-inc-ptr-3.c: Likewise.
David Malcolm [Tue, 25 Aug 2020 13:26:05 +0000 (09:26 -0400)]
analyzer: fix ICE on initializers for unsized array fields [PR96777]
gcc/analyzer/ChangeLog:
PR analyzer/96777
* region-model.h (class compound_svalue): Document that all keys
must be concrete.
(compound_svalue::compound_svalue): Move definition to svalue.cc.
* store.cc (binding_map::apply_ctor_to_region): Handle
initializers for trailing arrays with incomplete size.
* svalue.cc (compound_svalue::compound_svalue): Move definition
here from region-model.h. Add assertion that all keys are
concrete.
gcc/testsuite/ChangeLog:
PR analyzer/96777
* gcc.dg/analyzer/pr96777.c: New test.
GCC Administrator [Wed, 26 Aug 2020 00:16:32 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Fri, 26 Jun 2020 21:56:40 +0000 (14:56 -0700)]
x86: Change CTZ_DEFINED_VALUE_AT_ZERO to return 0/2
Change CTZ_DEFINED_VALUE_AT_ZERO/CTZ_DEFINED_VALUE_AT_ZERO to return 0/2
to enable table-based clz/ctz optimization:
-- Macro: CLZ_DEFINED_VALUE_AT_ZERO (MODE, VALUE)
-- Macro: CTZ_DEFINED_VALUE_AT_ZERO (MODE, VALUE)
A C expression that indicates whether the architecture defines a
value for 'clz' or 'ctz' with a zero operand. A result of '0'
indicates the value is undefined. If the value is defined for only
the RTL expression, the macro should evaluate to '1'; if the value
applies also to the corresponding optab entry (which is normally
the case if it expands directly into the corresponding RTL), then
the macro should evaluate to '2'. In the cases where the value is
defined, VALUE should be set to this value.
gcc/
PR target/95863
* config/i386/i386.h (CTZ_DEFINED_VALUE_AT_ZERO): Return 0/2.
(CLZ_DEFINED_VALUE_AT_ZERO): Likewise.
gcc/testsuite/
PR target/95863
* gcc.target/i386/pr95863-1.c: New test.
* gcc.target/i386/pr95863-2.c: Likewise.
Roger Sayle [Tue, 25 Aug 2020 18:02:45 +0000 (19:02 +0100)]
hppa: PR middle-end/87256: Improved hppa_rtx_costs avoids synth_mult madness.
This is my proposed fix to PR middle-end/87256 where synth_mult takes an
unreasonable amount of CPU time determining an optimal sequence of
instructions to perform multiplication by (large) integer constants on hppa.
One workaround proposed in bugzilla, is to increase the hash table used
to cache/reuse intermediate results. This helps but is a workaround for
the (hidden) underlying problem.
The real issue is that the hppa_rtx_costs function is providing wildly
inaccurate values (estimates) to the middle-end. For example, (p*q)+(r*s)
would appear to be cheaper than a single multiplication. Another
example is that "(ashiftrt:di regA regB)" is claimed to be only be
COST_N_INSNS(1) when in fact the hppa backend actually generates
slightly more than a single instruction.
It turns out that simply tightening up the logic in hppa_rtx_costs to
return more reasonable values, dramatically reduces the number of recursive
invocations in synth_mult for the test case in PR87256, and presumably
also produces faster code (that should be observable in benchmarks).
2020-08-25 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR middle-end/87256
* config/pa/pa.c (hppa_rtx_costs_shadd_p): New helper function
to check for coefficients supported by shNadd and shladd,l.
(hppa_rtx_costs): Rewrite to avoid using estimates based upon
FACTOR and enable recursing deeper into RTL expressions.
Roger Sayle [Tue, 25 Aug 2020 17:57:55 +0000 (18:57 +0100)]
hppa: Improve expansion of ashldi3 when !TARGET_64BIT
This patch improves the code generated on PA-RISC for DImode
(double word) left shifts by small constants (1-31). This target
has a very cool shd instruction that can be recognized by combine
for simple shifts, but relying on combine is fragile for more
complicated functions. This patch tweaks pa.md's ashldi3 expander,
to form the optimal two instruction shd/zdep sequence at RTL
expansion time.
As an example of the benefits of this approach, the simple function
unsigned long long u9(unsigned long long x) { return x*9; }
currently generates 9 instructions and with this patch now requires
only 7.
2020-08-25 Roger Sayle <roger@nextmovesoftware.com>
* config/pa/pa.md (ashldi3): Additionally, on !TARGET_64BIT
generate a two instruction shd/zdep sequence when shifting
registers by suitable constants.
(shd_internal): New define_expand to provide gen_shd_internal.
Tobias Burnus [Tue, 25 Aug 2020 15:46:13 +0000 (17:46 +0200)]
OpenMP: Improve map-clause error message for array function parameter (PR96678)
gcc/c/ChangeLog:
PR c/96678
* c-typeck.c (handle_omp_array_sections_1): Talk about
array function parameter in the error message.
gcc/cp/ChangeLog:
PR c/96678
* semantics.c (handle_omp_array_sections_1): Talk about
array function parameter in the error message.
gcc/testsuite/ChangeLog:
PR c/96678
* c-c++-common/gomp/map-4.c: New test.
* c-c++-common/gomp/depend-1.c: Update dg-error.
* c-c++-common/gomp/map-1.c: Likewise.
* c-c++-common/gomp/reduction-1.c: Likewise.
* g++.dg/gomp/depend-1.C: Likewise.
* g++.dg/gomp/depend-2.C: Likewise.
Jonathan Wakely [Tue, 25 Aug 2020 15:30:45 +0000 (16:30 +0100)]
libstdc++: Remove tests for self-move debug assertions
I recently removed the debug mode checks for self-move assignment, which
means these tests now fail when _GLIBCXX_DEBUG is added to the options
or when the check-debug target is used. Remove all the tests.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/21_strings/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/deque/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/deque/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/forward_list/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/forward_list/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/list/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/list/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/map/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/map/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/multimap/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/multimap/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/multiset/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/multiset/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/set/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/set/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_map/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_map/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_multimap/debug/iterator_self_move_assign_neg.cc:
Removed.
* testsuite/23_containers/unordered_multimap/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_multiset/debug/iterator_self_move_assign_neg.cc:
Removed.
* testsuite/23_containers/unordered_multiset/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_set/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/unordered_set/debug/self_move_assign_neg.cc: Removed.
* testsuite/23_containers/vector/debug/iterator_self_move_assign_neg.cc: Removed.
* testsuite/23_containers/vector/debug/self_move_assign_neg.cc: Removed.
Patrick Palka [Tue, 25 Aug 2020 15:23:05 +0000 (11:23 -0400)]
libstdc++: Fix debug-mode build failure in <chrono>
libstdc++-v3/ChangeLog:
* include/std/chrono (year_month_weekday::ok): Fix assert.
Jonathan Wakely [Tue, 25 Aug 2020 14:52:57 +0000 (15:52 +0100)]
libstdc++: Adjust static assertions in futures and promises [LWG 3466]
Add a static_assertions to check the result type is destructible, as in
the proposed resolution for LWG 3466 (which supersedes 3458).
libstdc++-v3/ChangeLog:
* include/std/future (future, shared_future. promise): Add
is_destructible assertion (LWG 3466). Adjust string-literal for
!is_array and !is_function assertions.
* testsuite/30_threads/future/requirements/lwg3458.cc: Check
types with no accessible destructor. Adjust expected errors.
* testsuite/30_threads/promise/requirements/lwg3466.cc:
Likewise.
* testsuite/30_threads/shared_future/requirements/lwg3458.cc:
Likewise.
Patrick Palka [Tue, 25 Aug 2020 14:23:59 +0000 (10:23 -0400)]
libstdc++: Add more C++20 additions to <chrono>
This patch adds the C++20 calendar types and their methods as defined in
[time.cal] (modulo the parsing/printing support). This patch also
implements [time.hms] and [time.12], and a few more bits of
[time.clock]. The remaining C++20 additions to <chrono> from P0355 and
P1466 depend on [time.zone] and <format>, so they will come later, as
will more optimized versions of some of the algorithms added here.
The non-member operator overloads for the calendar types are defined as
namespace-scope functions in the standard, but here we instead define
these operator overloads as hidden friends. This simplifies the
implementation somewhat and lets us reap the benefits of hidden friends
for these overloads.
The bulk of this work is based on a patch from Ed Smith-Rowland, which can
be found at the Git branch users/redi/heads/calendar.
Co-authored-by: Ed Smith-Rowland <3dw4rd@verizon.net>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/std/chrono (time_point::operator++)
(time_point::operator--): Define.
(utc_clock, tai_clock, gps_clock): Forward declare.
(utc_time, utc_seconds, tai_time, tai_seconds, gps_time)
(gps_seconds): Define.
(is_clock<utc_clock>, is_clock<tai_clock>, is_clock<gps_clock>)
(is_clock_v<utc_clock>, is_clock_v<tai_clock>)
(is_clock_v<gps_clock>): Define these specializations.
(leap_second_info): Define.
(day, month, year, weekday, weekday_indexed)
(weekday_last, month_day, month_day_last, month_weekday)
(month_weekday_last, year_month, year_month_day)
(year_month_day_last, year_month_weekday, year_month_weekday_last):
Declare and later define.
(last_spec, last, __detail::__days_per_month)
(__detail::__days_per_month, __detail::__last_day): Define.
(January, February, March, April, May, June, July, August)
(September, October, November, December, Sunday, Monday, Tuesday)
(Wednesday, Thursday, Friday, Saturday): Define.
(weekday::operator[]): Define out-of-line.
(year_month_day::_S_from_days, year_month_day::M_days_since_epoch):
Likewise.
(year_month_day::year_month_day, year_month_day::ok): Likewise.
(__detail::__pow10, hh_mm_ss): Define.
(literals::chrono_literals::operator""d)
(literals::chrono_literals::operator""y): Define.
(is_am, is_pm, make12, make24): Define.
* testsuite/20_util/time_point/4.cc: New test.
* testsuite/std/time/day/1.cc: New test.
* testsuite/std/time/hh_mm_ss/1.cc: New test.
* testsuite/std/time/is_am/1.cc: New test.
* testsuite/std/time/is_pm/1.cc: New test.
* testsuite/std/time/make12/1.cc: New test.
* testsuite/std/time/make24/1.cc: New test.
* testsuite/std/time/month/1.cc: New test.
* testsuite/std/time/month_day/1.cc: New test.
* testsuite/std/time/month_day_last/1.cc: New test.
* testsuite/std/time/month_weekday/1.cc: New test.
* testsuite/std/time/month_weekday_last/1.cc: New test.
* testsuite/std/time/weekday/1.cc: New test.
* testsuite/std/time/weekday_indexed/1.cc: New test.
* testsuite/std/time/weekday_last/1.cc: New test.
* testsuite/std/time/year/1.cc: New test.
* testsuite/std/time/year_month/1.cc: New test.
* testsuite/std/time/year_month_day/1.cc: New test.
* testsuite/std/time/year_month_day_last/1.cc: New test.
* testsuite/std/time/year_month_weekday/1.cc: New test.
* testsuite/std/time/year_month_weekday_last/1.cc: New test.
Richard Sandiford [Tue, 25 Aug 2020 12:31:17 +0000 (13:31 +0100)]
aarch64: Update feature macro name
GCC used the name __ARM_FEATURE_SVE_VECTOR_OPERATIONS, but in the
final spec it was renamed to__ARM_FEATURE_SVE_VECTOR_OPERATORS.
gcc/
* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Rename
__ARM_FEATURE_SVE_VECTOR_OPERATIONS to
__ARM_FEATURE_SVE_VECTOR_OPERATORS.
gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/attributes_1.c: Rename
__ARM_FEATURE_SVE_VECTOR_OPERATIONS to
__ARM_FEATURE_SVE_VECTOR_OPERATORS.
Richard Sandiford [Tue, 25 Aug 2020 12:31:17 +0000 (13:31 +0100)]
aarch64: Tweaks to the handling of fixed-length SVE types
This patch is really four things rolled into one, since separating
them seemed artificial:
- Update the mangling of the fixed-length SVE ACLE types to match
the upcoming spec. The idea is to mangle:
VLAT __attribute__((arm_sve_vector_bits(N)))
as an instance __SVE_VLS<VLAT, N> of the template:
__SVE_VLS<typename, unsigned>
- Give the fixed-length types their own TYPE_DECL. This is needed
to make the above mangling fix work, but should also be a minor
QoI improvement for error reporting. Unfortunately, the names are
quite verbose, e.g.:
svint8_t __attribute__((arm_sve_vector_bits(512)))
but anything shorter would be ad-hoc syntax and so might be more
confusing.
- Improve the error message reported when arm_sve_vector_bits is
applied to tuples, such as:
svint32x2_t __attribute__((arm_sve_vector_bits(N)))
Previously we would complain that the type isn't an SVE type;
now we complain that it isn't a vector type.
- Don't allow arm_sve_vector_bits(N) to be applied to existing
fixed-length SVE types.
gcc/
* config/aarch64/aarch64-sve-builtins.cc (add_sve_type_attribute):
Take the ACLE name of the type as a parameter and add it as fourth
argument to the "SVE type" attribute.
(register_builtin_types): Update call accordingly.
(register_tuple_type): Likewise. Construct the name of the type
earlier in order to do this.
(get_arm_sve_vector_bits_attributes): New function.
(handle_arm_sve_vector_bits_attribute): Report a more sensible
error message if the attribute is applied to an SVE tuple type.
Don't allow the attribute to be applied to an existing fixed-length
SVE type. Mangle the new type as __SVE_VLS<type, vector-bits>.
Add a dummy TYPE_DECL to the new type.
gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/attributes_2.C: New test.
* g++.target/aarch64/sve/acle/general-c++/mangle_6.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_7.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_8.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_9.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_10.C: Likewise.
* gcc.target/aarch64/sve/acle/general/attributes_7.c: Check the
error messages reported when arm_sve_vector_bits is applied to
SVE tuple types or to existing fixed-length SVE types.
Richard Sandiford [Tue, 25 Aug 2020 12:31:16 +0000 (13:31 +0100)]
aarch64: Update the mangling of single SVE vectors and predicates
GCC was implementing an old mangling scheme for single SVE
vectors and predicates (based on the Advanced SIMD one).
The final definition instead put them in the vendor built-in
namespace via the "u" prefix.
gcc/
* config/aarch64/aarch64-sve-builtins.cc (DEF_SVE_TYPE): Add a
leading "u" to each mangled name.
gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/mangle_1.C: Add a leading
"u" to the mangling of each SVE vector and predicate type.
* g++.target/aarch64/sve/acle/general-c++/mangle_2.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_3.C: Likewise.
* g++.target/aarch64/sve/acle/general-c++/mangle_5.C: Likewise.
Richard Biener [Tue, 25 Aug 2020 08:59:24 +0000 (10:59 +0200)]
tree-optimization/96548 - fix failure to recompute RPO after CFG change
This recomputes RPO after store-motion changes the CFG.
2020-08-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/96548
PR tree-optimization/96760
* tree-ssa-loop-im.c (tree_ssa_lim): Recompute RPO after
store-motion.
* gcc.dg/torture/pr96548.c: New testcase.
* gcc.dg/torture/pr96760.c: Likewise.
Jakub Jelinek [Tue, 25 Aug 2020 11:49:40 +0000 (13:49 +0200)]
gimple: Ignore *0 = {CLOBBER} in path isolation [PR96722]
Clobbers of MEM_REF with NULL address are just fancy nops, something we just
ignore and don't emit any code for it (ditto for other clobbers), they just
mark end of life on something, so we shouldn't infer from those that there
is some UB.
2020-08-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96722
* gimple.c (infer_nonnull_range): Formatting fix.
(infer_nonnull_range_by_dereference): Return false for clobber stmts.
* g++.dg/opt/pr96722.C: New test.
Jakub Jelinek [Tue, 25 Aug 2020 11:47:10 +0000 (13:47 +0200)]
strlen: Fix handle_builtin_string_cmp [PR96758]
The following testcase is miscompiled, because handle_builtin_string_cmp
sees a strncmp call with constant last argument 4, where one of the strings
has an upper bound of 5 bytes (due to it being an array of that size) and
the other has a known string length of 1 and the result is used only in
equality comparison.
It is folded into __builtin_strncmp_eq (str1, str2, 4), which is
incorrect, because that means reading 4 bytes from both strings and
comparing that. When one of the strings has known strlen of 1, we want to
compare just 2 bytes, not 4, as strncmp shouldn't compare any bytes beyond
the null.
So, the last argument to __builtin_strncmp_eq should be the minimum of the
provided strncmp last argument and the known string length + 1 (assuming
the other string has only a known upper bound due to array size).
Besides that, I've noticed the code has been written with the intent to also
support the case where we know exact string length of both strings (but not
the string content, so we can't compute it at compile time). In that case,
both cstlen1 and cstlen2 are non-negative and both arysiz1 and arysiz2 are
negative. We wouldn't optimize that, cmpsiz would be either the strncmp
last argument, or for strcmp the first string length, but varsiz would be
-1 and thus cmpsiz would be never < varsiz. The patch fixes it by using the
correct length, in that case using the minimum of the two and for strncmp
also the last argument.
2020-08-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96758
* tree-ssa-strlen.c (handle_builtin_string_cmp): If both cstlen1
and cstlen2 are set, set cmpsiz to their minimum, otherwise use the
one that is set. If bound is used and smaller than cmpsiz, set cmpsiz
to bound. If both cstlen1 and cstlen2 are set, perform the optimization.
* gcc.dg/strcmpopt_12.c: New test.
Martin Jambor [Tue, 25 Aug 2020 11:33:44 +0000 (13:33 +0200)]
sra: Bail out when encountering accesses with negative offsets (PR 96730)
I must admit I was quite surprised to see that SRA does not disqualify
an aggregate from any transformations when it encounters an offset for
which get_ref_base_and_extent returns a negative offset. It may not
matter too much because I sure hope such programs always have
undefined behavior (SRA candidates are local variables on stack) but
it is probably better not to perform weird transformations on them as
build ref model with the new build_reconstructed_reference function
currently happily do for negative offsets (they just copy the existing
expression which is then used as the expression of a "propagated"
access) and of course the compiler must not ICE (as it currently does
because the SRA forest verifier does not like the expression).
gcc/ChangeLog:
2020-08-24 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/96730
* tree-sra.c (create_access): Disqualify any aggregate with negative
offset access.
(build_ref_for_model): Add assert that offset is non-negative.
gcc/testsuite/ChangeLog:
2020-08-24 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/96730
* gcc.dg/tree-ssa/pr96730.c: New test.
Wei Wentao [Tue, 25 Aug 2020 10:41:24 +0000 (11:41 +0100)]
Fix a typo in rtl.def
gcc/
* rtl.def: Fix typo in comment.
Roger Sayle [Tue, 25 Aug 2020 09:50:48 +0000 (10:50 +0100)]
middle-end: PR tree-optimization/21137: STRIP_NOPS avoids missed optimization.
PR tree-optimization/21137 is now an old enhancement request pointing out
that an optimization I added back in 2006, to optimize "((x>>31)&64) != 0"
as "x < 0", doesn't fire in the presence of unanticipated type conversions.
The fix is to call STRIP_NOPS at the appropriate point.
2020-08-25 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR tree-optimization/21137
* fold-const.c (fold_binary_loc) [NE_EXPR/EQ_EXPR]: Call
STRIP_NOPS when checking whether to simplify ((x>>C1)&C2) != 0.
gcc/testsuite/ChangeLog
PR tree-optimization/21137
* gcc.dg/pr21137.c: New test.
Andrew Pinski [Tue, 25 Aug 2020 06:17:52 +0000 (14:17 +0800)]
MIPS: Fix __builtin_longjmp (PR 64242)
The problem here is mips has its own builtin_longjmp
pattern and it was not fixed when expand_builtin_longjmp
was fixed. We need to read the new fp and gp before
restoring the stack as the buffer might be a local
variable.
2020-08-25 Andrew Pinski <apinski@marvell.com>
gcc/ChangeLog:
PR middle-end/64242
* config/mips/mips.md (builtin_longjmp): Restore the frame
pointer and stack pointer and gp.
Richard Biener [Mon, 24 Aug 2020 12:12:01 +0000 (14:12 +0200)]
debug/96690 - mangle symbols eventually used by late dwarf output
The following makes sure to, at early debug generation time, mangle
symbols we eventually end up outputting during late finish.
2020-08-24 Richard Biener <rguenther@suse.de>
PR debug/96690
* dwarf2out.c (reference_to_unused): Make FUNCTION_DECL
processing more consistent with respect to
symtab->global_info_ready.
(tree_add_const_value_attribute): Unconditionally call
rtl_for_decl_init to do all mangling early but throw
away the result if early_dwarf.
* g++.dg/lto/pr96690_0.C: New testcase.