gcc.git
4 years agoAdd missing amdgcn vcondu patterns
Andrew Stubbs [Tue, 3 Dec 2019 16:20:29 +0000 (16:20 +0000)]
Add missing amdgcn vcondu patterns

2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md: Change "vcondu" patterns to use VEC_1REG_MODE
for the data mode.

From-SVN: r278940

4 years agoPR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
Marek Polacek [Tue, 3 Dec 2019 15:59:40 +0000 (15:59 +0000)]
PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.

This patch implements C++20 P0960R3: Parenthesized initialization of aggregates
(<wg21.link/p0960>; see R0 for more background info).  Essentially, if you have
an aggregate, you can now initialize it by (x, y), similarly to {x, y}.  E.g.

  struct A {
    int x, y;
    // no A(int, int) ctor (see paren-init14.C for = delete; case)
  };
  A a(1, 2);

The difference between ()-init and {}-init is that narrowing conversions are
permitted, designators are not permitted, a temporary object bound to
a reference does not have its lifetime extended, and there is no brace elision.
Further, things like

  int a[](1, 2, 3); // will deduce the array size
  const A& r(1, 2.3, 3); // narrowing is OK
  int (&&rr)[](1, 2, 3);
  int b[3](1, 2); // b[2] will be value-initialized

now work as expected.  Note that

  char f[]("fluff");

has always worked and this patch keeps it that way.  Also note that A a((1, 2))
is not the same as A a{{1,2}}; the inner (1, 2) remains a COMPOUND_EXPR.

The approach I took was to handle (1, 2) similarly to {1, 2} -- conjure up
a CONSTRUCTOR, and introduce LOOKUP_AGGREGATE_PAREN_INIT to distinguish
between the two.  This kind of initialization is only supported in C++20;
I've made no attempt to support it in earlier standards, like we don't
support CTAD pre-C++17, for instance.

* c-cppbuiltin.c (c_cpp_builtins): Predefine
__cpp_aggregate_paren_init=201902 for -std=c++2a.

* call.c (build_new_method_call_1): Handle parenthesized initialization
of aggregates by building up a CONSTRUCTOR.
(extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
* cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT):
Define.
* decl.c (grok_reference_init): Handle aggregate initialization from
a parenthesized list of values.
(reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
(check_initializer): Handle initialization of an array from a
parenthesized list of values.  Use NULL_TREE instead of NULL.
* tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P.
* typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it
receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set.  Allow
narrowing when LOOKUP_AGGREGATE_PAREN_INIT.
(massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing
flags to digest_init_r.

* g++.dg/cpp0x/constexpr-99.C: Only expect an error in C++17 and
lesser.
* g++.dg/cpp0x/explicit7.C: Likewise.
* g++.dg/cpp0x/initlist12.C: Adjust dg-error.
* g++.dg/cpp0x/pr31437.C: Likewise.
* g++.dg/cpp2a/feat-cxx2a.C: Add __cpp_aggregate_paren_init test.
* g++.dg/cpp2a/paren-init1.C: New test.
* g++.dg/cpp2a/paren-init10.C: New test.
* g++.dg/cpp2a/paren-init11.C: New test.
* g++.dg/cpp2a/paren-init12.C: New test.
* g++.dg/cpp2a/paren-init13.C: New test.
* g++.dg/cpp2a/paren-init14.C: New test.
* g++.dg/cpp2a/paren-init15.C: New test.
* g++.dg/cpp2a/paren-init16.C: New test.
* g++.dg/cpp2a/paren-init17.C: New test.
* g++.dg/cpp2a/paren-init18.C: New test.
* g++.dg/cpp2a/paren-init19.C: New test.
* g++.dg/cpp2a/paren-init2.C: New test.
* g++.dg/cpp2a/paren-init3.C: New test.
* g++.dg/cpp2a/paren-init4.C: New test.
* g++.dg/cpp2a/paren-init5.C: New test.
* g++.dg/cpp2a/paren-init6.C: New test.
* g++.dg/cpp2a/paren-init7.C: New test.
* g++.dg/cpp2a/paren-init8.C: New test.
* g++.dg/cpp2a/paren-init9.C: New test.
* g++.dg/ext/desig10.C: Adjust dg-error.
* g++.dg/template/crash107.C: Likewise.
* g++.dg/template/crash95.C: Likewise.
* g++.old-deja/g++.jason/crash3.C: Likewise.
* g++.old-deja/g++.law/ctors11.C: Likewise.
* g++.old-deja/g++.law/ctors9.C: Likewise.
* g++.old-deja/g++.mike/net22.C: Likewise.
* g++.old-deja/g++.niklas/t128.C: Likewise.

From-SVN: r278939

4 years agore PR target/92758 (r278833 breaks gcc.target/powerpc/fold-vec-splat-floatdouble.c)
Richard Biener [Tue, 3 Dec 2019 14:47:24 +0000 (14:47 +0000)]
re PR target/92758 (r278833 breaks gcc.target/powerpc/fold-vec-splat-floatdouble.c)

2019-12-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92758
* tree-ssa-forwprop.c (simplify_vector_constructor): Restore
operation on uniform vectors.

From-SVN: r278938

4 years agoValidate acc_device_t uses
Frederik Harwath [Tue, 3 Dec 2019 14:38:54 +0000 (14:38 +0000)]
Validate acc_device_t uses

Check that function arguments of type acc_device_t
are valid enumeration values in all publicly visible
functions from oacc-init.c.

2019-12-03  Frederik Harwath  <frederik@codesourcery.com>

libgomp/
* oacc-init.c (acc_known_device_type): Add function.
(unknown_device_type_error): Add function.
  (name_of_acc_device_t): Change to call unknown_device_type_error
on unknown type.
(resolve_device): Use acc_known_device_type.
  (acc_init): Fail if acc_device_t argument is not valid.
  (acc_shutdown): Likewise.
  (acc_get_num_devices): Likewise.
  (acc_set_device_type): Likewise.
(acc_get_device_num): Likewise.
(acc_set_device_num): Likewise.
  (acc_on_device): Add comment that argument validity is not checked.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r278937

4 years agoEnable OpenACC GCN testing.
Andrew Stubbs [Tue, 3 Dec 2019 12:53:53 +0000 (12:53 +0000)]
Enable OpenACC GCN testing.

2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

libgomp/
* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
Recognize amdgcn.
(check_effective_target_openacc_amdgcn_accel_present): New proc.
(check_effective_target_openacc_amdgcn_accel_selected): New proc.
* testsuite/libgomp.oacc-c++/c++.exp: Add support for amdgcn.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

From-SVN: r278935

4 years agore PR tree-optimization/92645 (Hand written vector code is 450 times slower when...
Richard Biener [Tue, 3 Dec 2019 11:59:13 +0000 (11:59 +0000)]
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
* gimple-fold.c (gimple_fold_builtin_memory_op): Fold memcpy
from or to a properly aligned register variable.

* gcc.target/i386/pr92645-5.c: New testcase.

From-SVN: r278934

4 years agoMakefile.in (SOURCES): Add doc/lto-dump.1.
Matthias Klose [Tue, 3 Dec 2019 11:30:34 +0000 (11:30 +0000)]
Makefile.in (SOURCES): Add doc/lto-dump.1.

2019-12-03  Matthias Klose  <doko@ubuntu.com>

        * Makefile.in (SOURCES): Add doc/lto-dump.1.
        (install-man): Add $(LTO_DUMP_INSTALL_NAME)$(man1ext).
        ($(LTO_DUMP_INSTALL_NAME)$(man1ext): New.

From-SVN: r278933

4 years agomusl: Fix invalid tls model in libgomp and libitm PR91938
Szabolcs Nagy [Tue, 3 Dec 2019 11:13:38 +0000 (11:13 +0000)]
musl: Fix invalid tls model in libgomp and libitm PR91938

Musl does not support initial-exec tls in dynamically loaded shared
libraries.

libgomp/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR libgomp/91938
* configure.tgt: Avoid IE tls on *-*-musl*.

libitm/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR libgomp/91938
* configure.tgt: Avoid IE tls on *-*-musl*.

From-SVN: r278932

4 years agore PR tree-optimization/92751 (VN partial def support confused about clobbers)
Richard Biener [Tue, 3 Dec 2019 10:46:52 +0000 (10:46 +0000)]
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

4 years agoutils.c (potential_alignment_gap): Delete.
Eric Botcazou [Tue, 3 Dec 2019 10:23:06 +0000 (10:23 +0000)]
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

4 years agoutils.c (fold_convert_size): New function.
Eric Botcazou [Tue, 3 Dec 2019 10:12:17 +0000 (10:12 +0000)]
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

4 years agoXFAIL loop_versioning_6.f90 for ! lp64
Richard Sandiford [Tue, 3 Dec 2019 10:11:58 +0000 (10:11 +0000)]
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

4 years agodecl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...
Eric Botcazou [Tue, 3 Dec 2019 10:06:15 +0000 (10:06 +0000)]
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

4 years agolibstdc++: Fix copyright date on new test header
Jonathan Wakely [Tue, 3 Dec 2019 09:51:49 +0000 (09:51 +0000)]
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

4 years agore PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_lo...
Jakub Jelinek [Tue, 3 Dec 2019 09:20:43 +0000 (10:20 +0100)]
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

4 years agore PR target/92744 (error: insn does not satisfy its constraints since r278439)
Uros Bizjak [Tue, 3 Dec 2019 08:23:06 +0000 (09:23 +0100)]
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

4 years agore PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)
Jakub Jelinek [Tue, 3 Dec 2019 08:21:29 +0000 (09:21 +0100)]
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

4 years agore PR c++/92705 (ICE: Segmentation fault (in build_new_op_1))
Jason Merrill [Tue, 3 Dec 2019 08:20:18 +0000 (09:20 +0100)]
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

4 years agore PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
Jakub Jelinek [Tue, 3 Dec 2019 08:19:04 +0000 (09:19 +0100)]
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

4 years agore PR tree-optimization/92645 (Hand written vector code is 450 times slower when...
Richard Biener [Tue, 3 Dec 2019 07:36:14 +0000 (07:36 +0000)]
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

4 years agoFix missing space of r278890
Luo Xiong Hu [Tue, 3 Dec 2019 01:46:16 +0000 (01:46 +0000)]
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

4 years agoDiagnose use of [*] in old-style parameter definitions (PR c/88704).
Joseph Myers [Tue, 3 Dec 2019 01:27:43 +0000 (01:27 +0000)]
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

4 years agoinline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of -fdump-ipa-inline.
Jakub Jelinek [Tue, 3 Dec 2019 00:33:27 +0000 (01:33 +0100)]
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

4 years agoDaily bump.
GCC Administrator [Tue, 3 Dec 2019 00:16:19 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278915

4 years agore PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
Jakub Jelinek [Mon, 2 Dec 2019 21:33:06 +0000 (22:33 +0100)]
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

4 years agoMake rs6000_invalid_builtin static.
Bill Schmidt [Mon, 2 Dec 2019 18:46:45 +0000 (18:46 +0000)]
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

4 years agoTighten check for vector types in fold_convertible_p (PR 92741)
Richard Sandiford [Mon, 2 Dec 2019 17:51:08 +0000 (17:51 +0000)]
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

4 years ago[AArch64] Catch attempts to use SVE types when SVE is disabled
Richard Sandiford [Mon, 2 Dec 2019 17:48:08 +0000 (17:48 +0000)]
[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

4 years ago[AArch64] Run general SVE ACLE tests for C
Richard Sandiford [Mon, 2 Dec 2019 17:44:30 +0000 (17:44 +0000)]
[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

4 years ago[AArch64] Add a couple of SVE ACLE comparison folds
Richard Sandiford [Mon, 2 Dec 2019 17:39:06 +0000 (17:39 +0000)]
[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

4 years ago[Committed][Arm][testsuite] Fix failure for arm-fp16-ops-*.C
Sudakshina Das [Mon, 2 Dec 2019 17:21:35 +0000 (17:21 +0000)]
[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

4 years agolibstdc++: Fix try_lock_until and try_lock_shared_until on arbitrary clock
Mike Crowe [Mon, 2 Dec 2019 16:23:14 +0000 (16:23 +0000)]
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

4 years agolibstdc++: Add full steady_clock support to shared_timed_mutex
Mike Crowe [Mon, 2 Dec 2019 16:23:10 +0000 (16:23 +0000)]
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

4 years agolibstdc++: Fix timed_mutex::try_lock_until on arbitrary clock (PR 91906)
Mike Crowe [Mon, 2 Dec 2019 16:23:06 +0000 (16:23 +0000)]
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

4 years agolibstdc++: PR 78237 Add full steady_clock support to timed_mutex
Mike Crowe [Mon, 2 Dec 2019 16:23:01 +0000 (16:23 +0000)]
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

4 years agolibstdc++: Improve tests for try_lock_until members of mutex types
Mike Crowe [Mon, 2 Dec 2019 16:22:53 +0000 (16:22 +0000)]
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

4 years agoRefactor IPA devirt a bit.
Martin Liska [Mon, 2 Dec 2019 11:18:31 +0000 (12:18 +0100)]
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

4 years agoFix dg failure
Jan Hubicka [Mon, 2 Dec 2019 11:11:34 +0000 (12:11 +0100)]
Fix dg failure

* g++.dg/lto/inline-crossmodule-1_0.C: fix template.

From-SVN: r278897

4 years agore PR tree-optimization/92742 (ICE in info_for_reduction, at tree-vect-loop.c:4367)
Richard Biener [Mon, 2 Dec 2019 10:50:45 +0000 (10:50 +0000)]
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

4 years agore PR tree-optimization/92712 (Performance regression with assumed values)
Jakub Jelinek [Mon, 2 Dec 2019 08:51:49 +0000 (09:51 +0100)]
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

4 years agoEnable recursive function versioning
Feng Xue [Mon, 2 Dec 2019 06:37:30 +0000 (06:37 +0000)]
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

4 years agoFix bugs relating to flexibly-sized objects in nios2 backend.
Sandra Loosemore [Mon, 2 Dec 2019 03:52:15 +0000 (22:52 -0500)]
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

4 years agoPR92398: Fix testcase failure of pr72804.c
Luo Xiong Hu [Mon, 2 Dec 2019 01:59:26 +0000 (01:59 +0000)]
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

4 years agoDaily bump.
GCC Administrator [Mon, 2 Dec 2019 00:16:12 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278889

4 years agore PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and...
Jerry DeLisle [Sun, 1 Dec 2019 22:29:43 +0000 (22:29 +0000)]
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

4 years agoprofile-count.h (profile_count::operator<): Use IPA value for comparsion.
Jan Hubicka [Sun, 1 Dec 2019 15:12:52 +0000 (16:12 +0100)]
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

4 years agoDaily bump.
GCC Administrator [Sun, 1 Dec 2019 00:16:25 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278883

4 years agoipa-inline.c (compute_max_insns): Return int64_t.
Jan Hubicka [Sat, 30 Nov 2019 23:19:58 +0000 (00:19 +0100)]
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

4 years agoUpdate max_bb_count in execute_fixup_cfg
Jan Hubicka [Sat, 30 Nov 2019 21:25:24 +0000 (22:25 +0100)]
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

4 years agocgraph.h (symtab_node): Add symver flag.
Jan Hubicka [Sat, 30 Nov 2019 21:03:25 +0000 (22:03 +0100)]
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

5 years ago[C] Add a target hook that allows targets to verify type usage
Richard Sandiford [Sat, 30 Nov 2019 18:50:06 +0000 (18:50 +0000)]
[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

5 years agocgraph.c (cgraph_node::dump): Dump unit_id and merged_extern_inline.
Jan Hubicka [Sat, 30 Nov 2019 16:56:45 +0000 (17:56 +0100)]
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

5 years agoDo not look at _data component in gfc_dep_resolver.
Thomas Koenig [Sat, 30 Nov 2019 15:02:50 +0000 (15:02 +0000)]
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

5 years agodriver: Do not warn about ineffective `-x' option if no inputs were given
Maciej W. Rozycki [Sat, 30 Nov 2019 11:10:50 +0000 (11:10 +0000)]
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

5 years agodoc: Correct `--enable-version-specific-runtime-libs' support information
Maciej W. Rozycki [Sat, 30 Nov 2019 11:06:59 +0000 (11:06 +0000)]
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

5 years agolibstdc++: Default to --enable-libstdcxx-filesystem-ts for *-*-mingw*
Jonathan Wakely [Sat, 30 Nov 2019 01:03:40 +0000 (01:03 +0000)]
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

5 years agolibstdc++: Fix experimental::filesystem::u8path(const Source&) for Windows
Jonathan Wakely [Sat, 30 Nov 2019 01:03:36 +0000 (01:03 +0000)]
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

5 years agoDaily bump.
GCC Administrator [Sat, 30 Nov 2019 00:16:20 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278868

5 years agore PR rtl-optimization/92283 (454.calculix miscomparison since r276645 with -O2 ...
Vladimir Makarov [Fri, 29 Nov 2019 22:04:21 +0000 (22:04 +0000)]
re PR rtl-optimization/92283 (454.calculix miscomparison since r276645 with -O2 -march=znver2)

2019-11-29  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/92283
* lra.c (lra): Update reg notes after inheritance sub-pass and
before constraint sub-pass.

From-SVN: r278865

5 years agore PR fortran/91003 (ICE when compiling LAPACK (CGEGV) with optimization)
Richard Biener [Fri, 29 Nov 2019 19:54:25 +0000 (19:54 +0000)]
re PR fortran/91003 (ICE when compiling LAPACK (CGEGV) with optimization)

2019-11-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/91003
* tree-vect-slp.c (vect_mask_constant_operand_p): Pass in the
operand number, avoid handling the non-condition operands of
COND_EXPRs as comparisons.
(vect_get_constant_vectors): Pass down the operand number.
(vect_get_slp_defs): Likewise.

* gfortran.dg/pr91003.f90: New testcase.

From-SVN: r278860

5 years agolibstdc++: Adjust some function templates for coding conventions
Jonathan Wakely [Fri, 29 Nov 2019 17:43:55 +0000 (17:43 +0000)]
libstdc++: Adjust some function templates for coding conventions

* include/bits/fs_path.h (path::operator/=): Change template-head to
use typename instead of class.
* include/experimental/bits/fs_path.h (path::operator/=): Likewise.
* include/std/ostream (operator<<): Likewise.

From-SVN: r278859

5 years agolibstdc++: P1423R3 char8_t remediation (4/4)
Tom Honermann [Fri, 29 Nov 2019 17:43:51 +0000 (17:43 +0000)]
libstdc++: P1423R3 char8_t remediation (4/4)

New tests

This patch adds new tests to validate new deleted overloads of wchar_t,
char8_t, char16_t, and char32_t for ordinary and wide formatted character and
string ostream inserters.

Additionally, new tests are added to validate invocations of u8path with
sequences of char8_t for both the C++17 and filesystem TS implementations.

2019-11-29  Tom Honermann  <tom@honermann.net>

New tests
* testsuite/27_io/basic_ostream/inserters_character/char/deleted.cc:
New test to validate deleted overloads of character and string
inserters for narrow ostreams.
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/deleted.cc:
New test to validate deleted overloads of character and string
inserters for wide ostreams.
* testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: New test
to validate u8path invocations with sequences of char8_t.
* testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc:
New test to validate u8path invocations with sequences of char8_t.

From-SVN: r278858

5 years agolibstdc++: P1423R3 char8_t remediation (3/4)
Tom Honermann [Fri, 29 Nov 2019 17:43:46 +0000 (17:43 +0000)]
libstdc++: P1423R3 char8_t remediation (3/4)

Updates to existing tests

This patch updates existing tests to validate the new value for the
__cpp_lib_char8_t feature test macros and to exercise u8path factory
function invocations with std::string, std::string_view, and interator
pair arguments.

2019-11-29  Tom Honermann  <tom@honermann.net>

Updates to existing tests
* testsuite/experimental/feat-char8_t.cc: Updated the expected
__cpp_lib_char8_t feature test macro value.
* testsuite/27_io/filesystem/path/factory/u8path.cc: Added testing of
u8path invocation with std::string, std::string_view, and iterators
thereof.
* testsuite/experimental/filesystem/path/factory/u8path.cc: Added
testing of u8path invocation with std::string, std::string_view, and
iterators thereof.

From-SVN: r278857

5 years agolibstdc++: P1423R3 char8_t remediation (2/4)
Tom Honermann [Fri, 29 Nov 2019 17:43:42 +0000 (17:43 +0000)]
libstdc++: P1423R3 char8_t remediation (2/4)

Update feature test macro, add deleted operators, update u8path

This patch increments the __cpp_lib_char8_t feature test macro, adds deleted
operator<< overloads for basic_ostream, and modifies u8path to accept
sequences of char8_t for both the C++17 implementation of std::filesystem, and
the filesystem TS implementation.

The implementation mechanism used for u8path differs between the C++17 and
filesystem TS implementations.  The changes to the former take advantage of
C++17 'if constexpr'.  The changes to the latter retain C++11 compatibility
and rely on tag dispatching.

2019-11-29  Tom Honermann  <tom@honermann.net>

Update feature test macro, add deleted operators, update u8path
* include/bits/c++config: Bumped the value of the __cpp_lib_char8_t
feature test macro.
* include/bits/fs_path.h (u8path): Modified u8path to accept sequences
of char8_t.
* include/experimental/bits/fs_path.h (u8path): Modified u8path to
accept sequences of char8_t.
* include/std/ostream: Added deleted overloads of wchar_t, char8_t,
char16_t, and char32_t for ordinary and wide formatted character and
string inserters.

From-SVN: r278856

5 years agolibstdc++: P1423R3 char8_t remediation (1/4)
Tom Honermann [Fri, 29 Nov 2019 17:43:37 +0000 (17:43 +0000)]
libstdc++: P1423R3 char8_t remediation (1/4)

Decouple constraints for u8path from path constructors

This patch moves helper classes and functions for std::filesystem::path out of
the class definition to a detail namespace so that they are available to the
implementations of std::filesystem::u8path.  Prior to this patch, the SFINAE
constraints for those implementations were specified via delegation to the
overloads of path constructors with a std::locale parameter; it just so
happened that those overloads had the same constraints.  As of P1423R3, u8path
and those overloads no longer have the same constraints, so this dependency
must be broken.

This patch also updates the experimental implementation of the filesystem TS
to add SFINAE constraints to its implementations of u8path.  These functions
were previously unconstrained and marked with a TODO comment.

This patch does not provide any intentional behavioral changes other than the
added constraints to the experimental filesystem TS implementation of u8path.

Alternatives to this refactoring would have been to make the u8path overloads
friends of class path, or to make the helpers public members. Both of those
approaches struck me as less desirable than this approach, though this
approach does require more code changes and will affect implementation detail
portions of mangled names for path constructors and inline member functions
(mostly function template specializations).

2019-11-29  Tom Honermann  <tom@honermann.net>

Decouple constraints for u8path from path constructors
* include/bits/fs_path.h: Moved helper utilities out of
std::filesystem::path into a detail namespace to make them
available for use by u8path.
* include/experimental/bits/fs_path.h: Moved helper utilities out
of std::experimental::filesystem::v1::path into a detail
namespace to make them available for use by u8path.

From-SVN: r278855

5 years agoFix ICE in re-simplification of VEC_COND_EXPR
Frederik Harwath [Fri, 29 Nov 2019 15:02:35 +0000 (15:02 +0000)]
Fix ICE in re-simplification of VEC_COND_EXPR

The function maybe_resimplify_conditional_op uses operation_could_trap_p to
check if the resulting operation of a simplification can trap.  Because of the
changes introduced by revision r276659, this results in an ICE due to a
violated assertion in operation_could_trap_p if the operation is a COND_EXPR or
a VEC_COND_EXPR.  The changes have allowed those expressions to trap and
whether they do cannot be determined without considering their condition
which is not available to operation_could_trap_p.

Change maybe_resimplify_conditional_op to inspect the condition of
COND_EXPRs and VEC_COND_EXPRs to determine if they can trap.

From-SVN: r278853

5 years agoFix DR_GROUP_GAP for strided accesses (PR 92677)
Richard Sandiford [Fri, 29 Nov 2019 14:48:30 +0000 (14:48 +0000)]
Fix DR_GROUP_GAP for strided accesses (PR 92677)

When dissolving an SLP-only group of accesses, we should only set
the gap to group_size - 1 for normal non-strided groups.

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

gcc/
PR tree-optimization/92677
* tree-vect-loop.c (vect_dissolve_slp_only_groups): Set the gap
to zero when dissolving a group of strided accesses.

gcc/testsuite/
PR tree-optimization/92677
* gcc.dg/vect/pr92677.c: New test.

From-SVN: r278852

5 years agoDon't defer choice of vector type for bools (PR 92596)
Richard Sandiford [Fri, 29 Nov 2019 14:47:44 +0000 (14:47 +0000)]
Don't defer choice of vector type for bools (PR 92596)

Now that stmt_vec_info records the choice between vector mask
types and normal nonmask types, we can use that information in
vect_get_vector_types_for_stmt instead of deferring the choice
of vector type till later.

vect_get_mask_type_for_stmt used to check whether the boolean inputs
to an operation:
(a) consistently used mask types or consistently used nonmask types; and
(b) agreed on the number of elements.

(b) shouldn't be a problem when (a) is met.  If the operation
consistently uses mask types, tree-vect-patterns.c will have corrected
any mismatches in mask precision.  (This is because we only use mask
types for a small well-known set of operations and tree-vect-patterns.c
knows how to handle any that could have different mask precisions.)
And if the operation consistently uses normal nonmask types, there's
no reason why booleans should need extra vector compatibility checks
compared to ordinary integers.

So the potential difficulties all seem to come from (a).  Now that
we've chosen the result type ahead of time, we also have to consider
whether the outputs and inputs consistently use mask types.

Taking each vectorizable_* routine in turn:

- vectorizable_call

    vect_get_vector_types_for_stmt only handled booleans specially
    for gassigns, so vect_get_mask_type_for_stmt never had chance to
    handle calls.  I'm not sure we support any calls that operate on
    booleans, but as things stand, a boolean result would always have
    a nonmask type.  Presumably any vector argument would also need to
    use nonmask types, unless it corresponds to internal_fn_mask_index
    (which is already a special case).

    For safety, I've added a check for mask/nonmask combinations here
    even though we didn't check this previously.

- vectorizable_simd_clone_call

    Again, vect_get_mask_type_for_stmt never had chance to handle calls.
    The result of the call will always be a nonmask type and the patch
    for PR 92710 rejects mask arguments.  So all booleans should
    consistently use nonmask types here.

- vectorizable_conversion

    The function already rejects any conversion between booleans in which
    one type isn't a mask type.

- vectorizable_operation

    This function definitely needs a consistency check, e.g. to handle
    & and | in which one operand is loaded from memory and the other is
    a comparison result.  Ideally we'd handle this via pattern stmts
    instead (like we do for the all-mask case), but that's future work.

- vectorizable_assignment

    VECT_SCALAR_BOOLEAN_TYPE_P requires single-bit precision, so the
    current code already rejects problematic cases.

- vectorizable_load

    Loads always produce nonmask types and there are no relevant inputs
    to check against.

- vectorizable_store

    vect_check_store_rhs already rejects mask/nonmask combinations
    via useless_type_conversion_p.

- vectorizable_reduction
- vectorizable_lc_phi

    PHIs always have nonmask types.  After the change above, attempts
    to combine the PHI result with a mask type would be rejected by
    vectorizable_operation.  (Again, it would be better to handle
    this using pattern stmts.)

- vectorizable_induction

    We don't generate inductions for booleans.

- vectorizable_shift

    The function already rejects boolean shifts via type_has_mode_precision_p.

- vectorizable_condition

    The function already rejects mismatches via useless_type_conversion_p.

- vectorizable_comparison

    The function already rejects comparisons between mask and nonmask types.
    The result is always a mask type.

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

gcc/
PR tree-optimization/92596
* tree-vect-stmts.c (vectorizable_call): Punt on hybrid mask/nonmask
operations.
(vectorizable_operation): Likewise, instead of relying on
vect_get_mask_type_for_stmt to do this.
(vect_get_vector_types_for_stmt): Always return a vector type
immediately, rather than deferring the choice for boolean results.
Use a vector mask type instead of a normal vector if
vect_use_mask_type_p.
(vect_get_mask_type_for_stmt): Delete.
* tree-vect-loop.c (vect_determine_vf_for_stmt_1): Remove
mask_producers argument and special boolean_type_node handling.
(vect_determine_vf_for_stmt): Remove mask_producers argument and
update calls to vect_determine_vf_for_stmt_1.  Remove doubled call.
(vect_determine_vectorization_factor): Update call accordingly.
* tree-vect-slp.c (vect_build_slp_tree_1): Remove special
boolean_type_node handling.
(vect_slp_analyze_node_operations_1): Likewise.

gcc/testsuite/
PR tree-optimization/92596
* gcc.dg/vect/bb-slp-pr92596.c: New test.
* gcc.dg/vect/bb-slp-43.c: Likewise.

From-SVN: r278851

5 years agoRecord the vector mask precision in stmt_vec_info
Richard Sandiford [Fri, 29 Nov 2019 14:47:39 +0000 (14:47 +0000)]
Record the vector mask precision in stmt_vec_info

search_type_for_mask uses a worklist to search a chain of boolean
operations for a natural vector mask type.  This patch instead does
that in vect_determine_stmt_precisions, where we also look for
overpromoted integer operations.  We then only need to compute
the precision once and can cache it in the stmt_vec_info.

The new function vect_determine_mask_precision is supposed
to handle exactly the same cases as search_type_for_mask_1,
and in the same way.  There's a lot we could improve here,
but that's not stage 3 material.

I wondered about sharing mask_precision with other fields like
operation_precision, but in the end that seemed too dangerous.
We have patterns to convert between boolean and non-boolean
operations and it would be very easy to get mixed up about
which case the fields are describing.

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

gcc/
* tree-vectorizer.h (stmt_vec_info::mask_precision): New field.
(vect_use_mask_type_p): New function.
* tree-vect-patterns.c (vect_init_pattern_stmt): Copy the
mask precision to the pattern statement.
(append_pattern_def_seq): Add a scalar_type_for_mask parameter
and use it to initialize the new stmt's mask precision.
(search_type_for_mask_1): Delete.
(search_type_for_mask): Replace with...
(integer_type_for_mask): ...this new function.  Use the information
cached in the stmt_vec_info.
(vect_recog_bool_pattern): Update accordingly.
(build_mask_conversion): Pass the scalar type associated with the
mask type to append_pattern_def_seq.
(vect_recog_mask_conversion_pattern): Likewise.  Call
integer_type_for_mask instead of search_type_for_mask.
(vect_convert_mask_for_vectype): Call integer_type_for_mask instead
of search_type_for_mask.
(possible_vector_mask_operation_p): New function.
(vect_determine_mask_precision): Likewise.
(vect_determine_stmt_precisions): Call it.

From-SVN: r278850

5 years agoMake vect_get_mask_type_for_stmt take a group size
Richard Sandiford [Fri, 29 Nov 2019 14:47:34 +0000 (14:47 +0000)]
Make vect_get_mask_type_for_stmt take a group size

This patch makes vect_get_mask_type_for_stmt and
get_mask_type_for_scalar_type take a group size instead of
the SLP node, so that later patches can call it before an
SLP node has been built.

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

gcc/
* tree-vectorizer.h (get_mask_type_for_scalar_type): Replace
the slp_tree parameter with a group size parameter.
(vect_get_mask_type_for_stmt): Likewise.
* tree-vect-stmts.c (get_mask_type_for_scalar_type): Likewise.
(vect_get_mask_type_for_stmt): Likewise.
* tree-vect-slp.c (vect_slp_analyze_node_operations_1): Update
call accordingly.

From-SVN: r278849

5 years agoMake vectorizable_operation punt early on codes it doesn't handle
Richard Sandiford [Fri, 29 Nov 2019 14:47:28 +0000 (14:47 +0000)]
Make vectorizable_operation punt early on codes it doesn't handle

vectorizable_operation returned false for codes that are handled by
vectorizable_shift, but only after it had already done a lot of work.
Checking earlier should be more efficient and avoid polluting the logs
with duplicate info.

Also, there was no such early-out for comparisons or COND_EXPRs.
Fixing that avoids a false scan-tree-dump hit with a later patch.

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

gcc/
* tree-vect-stmts.c (vectorizable_operation): Punt early
on codes that are handled elsewhere.

From-SVN: r278848

5 years agoImprove tree-vect-patterns.c handling of boolean comparisons
Richard Sandiford [Fri, 29 Nov 2019 14:47:20 +0000 (14:47 +0000)]
Improve tree-vect-patterns.c handling of boolean comparisons

vect_recog_bool_pattern assumed that a comparison between two booleans
should always become a comparison of vector mask types (implemented as an
XOR_EXPR).  But if the booleans in question are generated as data values
(e.g. because they're loaded directly from memory), we should treat them
like ordinary integers instead, just as we do for boolean logic ops whose
operands are loaded from memory.  vect_get_mask_type_for_stmt already
handled this case:

      /* We may compare boolean value loaded as vector of integers.
 Fix mask_type in such case.  */
      if (mask_type
  && !VECTOR_BOOLEAN_TYPE_P (mask_type)
  && gimple_code (stmt) == GIMPLE_ASSIGN
  && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison)
mask_type = truth_type_for (mask_type);

and not handling it here complicated later patches.

The initial list of targets for vect_bool_cmp is deliberately conservative.

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

gcc/
* doc/sourcebuild.texi (vect_bool_cmp): Document.
* tree-vect-patterns.c (search_type_for_mask_1): If neither
operand to a boolean comparison is a natural vector mask,
handle both operands like normal integers instead.

gcc/testsuite/
* gcc.dg/vect/vect-bool-cmp-2.c: New test.
* lib/target-supports.exp (check_effective_target_vect_bool_cmp): New
effective target procedure.

From-SVN: r278847

5 years agolibstdc++:: improve how pretty printers find node types (PR 91997)
Jonathan Wakely [Fri, 29 Nov 2019 14:47:03 +0000 (14:47 +0000)]
libstdc++:: improve how pretty printers find node types (PR 91997)

This fixes two related problems.

The iterators for node-based containers use nested typedefs such as
std::list<T>::iterator::_Node to denote their node types. As reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1053438 those typedefs are
not always present in the debug info. That means the pretty printers
cannot find them using gdb.lookup_type (via the find_type helper).
Instead of looking up the nested typedefs this patch makes the printers
look up the actual class templates directly.

A related problem (and the original topic of PR 91997) is that GDB fails
to find types via gdb.lookup_type when printing a backtrace from a
non-C++ functiion: https://sourceware.org/bugzilla/show_bug.cgi?id=25234
That is also solved by not looking up the nested typedef.

PR libstdc++/91997
* python/libstdcxx/v6/printers.py (find_type): Fail more gracefully
if we run out of base classes to look at.
(llokup_templ_spec, lookup_node_type): New utilities to find node
types for node-based containers.
(StdListPrinter.children, NodeIteratorPrinter.__init__)
(NodeIteratorPrinter.to_string, StdSlistPrinter.children)
(StdSlistIteratorPrinter.to_string, StdRbtreeIteratorPrinter.__init__)
(StdMapPrinter.children, StdSetPrinter.children)
(StdForwardListPrinter.children): Use lookup_node_type instead of
find_type.
(StdListIteratorPrinter.__init__, StdFwdListIteratorPrinter.__init__):
Pass name of node type to NodeIteratorPrinter constructor.
(Tr1HashtableIterator.__init__): Rename argument.
(StdHashtableIterator.__init__): Likewise. Use lookup_templ_spec
instead of find_type.
* testsuite/libstdc++-prettyprinters/59161.cc: Remove workaround for
_Node typedef not being present in debuginfo.
* testsuite/libstdc++-prettyprinters/91997.cc: New test.

From-SVN: r278846

5 years agoFortran] OpenACC – permit common blocks in some clauses
Tobias Burnus [Fri, 29 Nov 2019 13:59:21 +0000 (13:59 +0000)]
Fortran] OpenACC – permit common blocks in some clauses

        * testsuite/libgomp.oacc-fortran/declare-5.f90: Extend by
        adding a common-block test case.

From-SVN: r278845

5 years agotree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Bail out early for too large...
Richard Biener [Fri, 29 Nov 2019 13:53:10 +0000 (13:53 +0000)]
tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Bail out early for too large objects.

2019-11-29  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Bail
out early for too large objects.

From-SVN: r278844

5 years agoFortran] OpenACC – permit common blocks in some clauses
Tobias Burnus [Fri, 29 Nov 2019 13:49:44 +0000 (14:49 +0100)]
Fortran] OpenACC – permit common blocks in some clauses

        * fortran.dg/goacc/common-block-3.f90: Check that unused common-block
        variables do not get mapped.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r278843

5 years agoAdd an x86_64 test for PR 92476
Martin Jambor [Fri, 29 Nov 2019 13:36:47 +0000 (14:36 +0100)]
Add an x86_64 test for PR 92476

2019-11-29  Martin Jambor  <mjambor@suse.cz>

PR ipa/92476
        * g++.dg/lto/pr92476_[01].C: New test.

From-SVN: r278842

5 years agoipa-cp: Avoid ICEs when looking at expanded thunks and unoptimized functions
Martin Jambor [Fri, 29 Nov 2019 13:29:35 +0000 (14:29 +0100)]
ipa-cp: Avoid ICEs when looking at expanded thunks and unoptimized functions

2019-11-29  Martin Jambor  <mjambor@suse.cz>

PR ipa/92476
* ipa-cp.c (set_single_call_flag): Set node_calling_single_call in
the summary only if the summary exists.
(find_more_scalar_values_for_callers_subset): Check node_dead in
the summary only if the summary exists.
(ipcp_store_bits_results): Ignore nodes without lattices.
(ipcp_store_vr_results): Likewise.
* cgraphclones.c: Include ipa-fnsummary.h and ipa-prop.h and the
header files required by them.
(cgraph_node::expand_all_artificial_thunks): Analyze expanded thunks.

From-SVN: r278841

5 years agoDon't pass booleans as mask types to simd clones (PR 92710)
Richard Sandiford [Fri, 29 Nov 2019 13:04:56 +0000 (13:04 +0000)]
Don't pass booleans as mask types to simd clones (PR 92710)

In this PR we assigned a vector mask type to the result of a comparison
and then tried to pass that mask type to a simd clone, which expected
a normal (non-mask) type instead.

This patch simply punts on call arguments that have a mask type.
A better fix would be to pattern-match the comparison to a COND_EXPR,
like we would if the comparison was stored to memory, but doing that
isn't gcc 9 or 10 material.

Note that this doesn't affect x86_64-linux-gnu because the ABI promotes
bool arguments to ints.

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

gcc/
PR tree-optimization/92710
* tree-vect-stmts.c (vectorizable_simd_clone_call): Reject
vector mask arguments.

gcc/testsuite/
PR tree-optimization/92710
* gcc.dg/vect/pr92710.c: New test.

From-SVN: r278839

5 years agogcc/testsuite/ChangeLog - fix date in date line
Tobias Burnus [Fri, 29 Nov 2019 12:24:27 +0000 (13:24 +0100)]
gcc/testsuite/ChangeLog - fix date in date line

From-SVN: r278837

5 years agoFix testcase - was missing -fopenacc
Tobias Burnus [Fri, 29 Nov 2019 12:18:50 +0000 (12:18 +0000)]
Fix testcase - was missing -fopenacc

        PR ipa/84963
        * gfortran.dg/goacc/pr84963.f90: Use dg-additional-options not
        dg-options as otherwise -fopenacc is not used.

From-SVN: r278836

5 years agoprofile-count.c (profile_count::to_cgraph_frequency, [...]): Check for compaibility...
Jan Hubicka [Fri, 29 Nov 2019 10:29:44 +0000 (11:29 +0100)]
profile-count.c (profile_count::to_cgraph_frequency, [...]): Check for compaibility of counts.

* profile-count.c (profile_count::to_cgraph_frequency,
profile_count::to_sreal_scale): Check for compaibility of counts.
* profile-count.h (compatible_p): Make public; add checking for
global0 versus global types.
* cgraph.c (cgraph_node::verify_node): Verify count compatibility.

From-SVN: r278835

5 years agoTestsuite: Turn off vect-epilogue-nomask for slp-rect-3
Tamar Christina [Fri, 29 Nov 2019 09:22:15 +0000 (09:22 +0000)]
Testsuite: Turn off vect-epilogue-nomask for slp-rect-3

Without epiloque no mask it would only try HI modes, but thanks to the
epiloques nomask It tries QI mode as well which succeeds.  The xfail
then generates an xpass since the condition on it checks for HI to SI
and not QI.

So I disabled the epiloque mask since it seems to violate the conditions
the test actually wanted to test for.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/slp-reduc-3.c: Turn off epilogue-nomask.

From-SVN: r278834

5 years agore PR tree-optimization/92715 (error: position plus size exceeds size of referenced...
Richard Biener [Fri, 29 Nov 2019 09:18:48 +0000 (09:18 +0000)]
re PR tree-optimization/92715 (error: position plus size exceeds size of referenced object in  ‘bit_field_ref’)

2019-11-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92715
* tree-ssa-forwprop.c (simplify_vector_constructor): Bail
out for uniform vectors and source vectors with less elements
than the destination.

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

From-SVN: r278833

5 years agore PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
Jakub Jelinek [Fri, 29 Nov 2019 09:10:44 +0000 (10:10 +0100)]
re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)

PR c++/60228
* parser.c (cp_parser_omp_declare_reduction_exprs): If
processing_template_decl, wrap the combiner or initializer
into EXPR_STMT.
* decl.c (start_preparsed_function): Don't start a lambda scope
for DECL_OMP_DECLARE_REDUCTION_P functions.
(finish_function): Don't finish a lambda scope for
DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
them nor cp_genericize them.
* mangle.c (decl_mangling_context): Look through
DECL_OMP_DECLARE_REDUCTION_P functions.
* semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
functions, use tentative linkage, don't keep their bodies with
-fkeep-inline-functions and return false at the end.

* g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for
DECL_OMP_DECLARE_REDUCTION_P functions.

* testsuite/libgomp.c++/udr-20.C: New test.
* testsuite/libgomp.c++/udr-21.C: New test.

From-SVN: r278832

5 years agore PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
Jakub Jelinek [Fri, 29 Nov 2019 09:08:46 +0000 (10:08 +0100)]
re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)

PR c++/60228
* parser.c (cp_parser_omp_declare_reduction_exprs): If
processing_template_decl, wrap the combiner or initializer
into EXPR_STMT.
* decl.c (start_preparsed_function): Don't start a lambda scope
for DECL_OMP_DECLARE_REDUCTION_P functions.
(finish_function): Don't finish a lambda scope for
DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
them nor cp_genericize them.
* mangle.c (decl_mangling_context): Look through
DECL_OMP_DECLARE_REDUCTION_P functions.
* semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
functions, use tentative linkage, don't keep their bodies with
-fkeep-inline-functions and return false at the end.

* g++.dg/gomp/openmp-simd-2.C: Don't expect bodies for
DECL_OMP_DECLARE_REDUCTION_P functions.

* testsuite/libgomp.c++/udr-20.C: New test.
* testsuite/libgomp.c++/udr-21.C: New test.

From-SVN: r278831

5 years agoCheck for TYPE_NAME in type_with_linkage_p.
Martin Liska [Fri, 29 Nov 2019 09:03:25 +0000 (10:03 +0100)]
Check for TYPE_NAME in type_with_linkage_p.

2019-11-29  Martin Liska  <mliska@suse.cz>

PR lto/91574
* ipa-devirt.c (types_same_for_odr): Check for existence
of TYPE_NAMEs first.
2019-11-29  Martin Liska  <mliska@suse.cz>

PR lto/91574
* g++.dg/lto/pr91574_0.C: New test.

From-SVN: r278829

5 years agore PR tree-optimization/92704 (ICE: Segmentation fault (in process_bb))
Richard Biener [Fri, 29 Nov 2019 08:05:03 +0000 (08:05 +0000)]
re PR tree-optimization/92704 (ICE: Segmentation fault (in process_bb))

2019-11-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92704
* tree-if-conv.c (combine_blocks): Deal with virtual PHIs
in loops performing only loads.

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

From-SVN: r278828

5 years agoHandle C2x attributes in Objective-C.
Joseph Myers [Fri, 29 Nov 2019 01:06:57 +0000 (01:06 +0000)]
Handle C2x attributes in Objective-C.

When adding the initial support for C2x attributes, I deferred the
unbounded lookahead support required to support such attributes in
Objective-C (except for the changes to string literal handling, which
were the riskier piece of preparation for such lookahead support).
This patch adds that remaining ObjC support.

For C, the parser continues to work exactly as it did before.  For
ObjC, however, when checking for whether '[[' starts attributes, it
lexes however many tokens are needed to check for a matching ']]', but
in a raw mode that omits all the context-sensitive processing that
c_lex_with_flags normally does, so that that processing can be done
later when the right context-sensitive flags are set.  Those tokens
are saved in a separate raw_tokens vector in the parser, and normal
c_lex_one_token calls will get tokens from there and perform the
remaining processing on them, if any tokens are found there, so all
parsing not using the new interfaces gets the same tokens as it did
before.  (For C, this raw lexing never occurs and the vector of raw
tokens is always NULL.)

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

gcc/c:
* c-parser.c (struct c_parser): Add members raw_tokens and
raw_tokens_used.
(c_lex_one_token): Add argument raw.  Handle lexing raw tokens and
using previously-lexed raw tokens.
(c_parser_peek_nth_token_raw)
(c_parser_check_balanced_raw_token_sequence): New functions.
(c_parser_nth_token_starts_std_attributes): Use
c_parser_check_balanced_raw_token_sequence for Objective-C.

gcc/testsuite:
* objc.dg/attributes/gnu2x-attr-syntax-1.m: New test.

From-SVN: r278827

5 years agoRemove unused decimal floating-point pointer types
Julian Brown [Fri, 29 Nov 2019 00:58:35 +0000 (00:58 +0000)]
Remove unused decimal floating-point pointer types

gcc/
* builtin-types.def (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR,
BT_DFLOAT128_PTR) Remove.
* tree-core.h (TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE,
TI_DFLOAT128_PTR_TYPE): Remove.
* tree.c (build_common_type_nodes): Remove dfloat32_ptr_type_node,
dfloat64_ptr_type_node and dfloat128_ptr_type_node initialisation.
* tree.h (dfloat32_ptr_type_node, dfloat64_ptr_type_node,
dfloat128_ptr_type_node): Remove macros.

gcc/jit/
* jit-builtins.c (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR):
Remove commented-out cases.

Reviewed-by: Joseph Myers <joseph@codesourcery.com>
From-SVN: r278826

5 years agoDaily bump.
GCC Administrator [Fri, 29 Nov 2019 00:16:20 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278825

5 years agors6000: Fix formatting of *mov{si,di}_internal.*
Segher Boessenkool [Thu, 28 Nov 2019 23:50:06 +0000 (00:50 +0100)]
rs6000: Fix formatting of *mov{si,di}_internal.*

* config/rs6000/rs6000.md (*movsi_internal1): Fix formatting.  Improve
formatting.
(*movdi_internal64): Ditto.

From-SVN: r278822

5 years agors6000: Use memory_operand for all simple {l,st}*brx instructions
Segher Boessenkool [Thu, 28 Nov 2019 22:28:59 +0000 (23:28 +0100)]
rs6000: Use memory_operand for all simple {l,st}*brx instructions

We run fwprop before combine, very early even in the case of fwprop1;
and fwprop1 will change memory addressing to what it considers cheaper.
After the "common" change, it now changes the indexed store instruction
in the testcase to be to a constant address.  But that is not an
improvement at all: the byte reverse instructions only exist in the
indexed form, so they will not match anymore.

This patch changes the patterns for the byte reverse instructions to
allow plain memory_operand, letting reload fix this up.

PR target/92602
* config/rs6000/rs6000.md (bswap<mode>2_load for HSI): Change the
indexed_or_indirect_operand to be memory_operand.
(bswap<mode>2_store for HSI): Ditto.
(bswapdi2_load): Ditto.
(bswapdi2_store): Ditto.

From-SVN: r278821

5 years agoTranslate header for -fdbg-cnt-list.
Martin Liska [Thu, 28 Nov 2019 20:56:51 +0000 (21:56 +0100)]
Translate header for -fdbg-cnt-list.

2019-11-28  Martin Liska  <mliska@suse.cz>

PR debug/46558
* dbgcnt.c (dbg_cnt_list_all_counters): Mark table
headers for translation.

From-SVN: r278820

5 years agoProperly use TYPE_MAIN_VARIANT in warn_types_mismatch.
Martin Liska [Thu, 28 Nov 2019 20:56:23 +0000 (21:56 +0100)]
Properly use TYPE_MAIN_VARIANT in warn_types_mismatch.

2019-11-28  Martin Liska  <mliska@suse.cz>

PR lto/92609
* ipa-devirt.c (warn_types_mismatch): Use TYPE_MAIN_VARIANT
consistently.
2019-11-28  Martin Liska  <mliska@suse.cz>

PR lto/92609
* g++.dg/lto/pr92609_0.C: New test.
* g++.dg/lto/pr92609_1.C: New test.

From-SVN: r278819

5 years ago[Darwin, X86, testsuite] Update tests for common section use.
Iain Sandoe [Thu, 28 Nov 2019 19:41:55 +0000 (19:41 +0000)]
[Darwin, X86, testsuite] Update tests for common section use.

The switch to default of no-common means that we no longer
indirect the accesses to 'xxx' in this test.  Adjust the scan-
assembler tests to reflect this.

gcc/testsuite/ChangeLog:

2019-11-28  Iain Sandoe  <iain@sandoe.co.uk>

* gcc.target/i386/pr32219-2.c: Adjust scan-assembler entries
for revised common default.

From-SVN: r278818

5 years agore PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and...
Jerry DeLisle [Thu, 28 Nov 2019 18:33:20 +0000 (18:33 +0000)]
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)

PR fortran/90374
* io.c (check_format): Allow zero width expoenent with e0.

* io/format.c (parse_format_list): Relax format checking to allow
e0 exponent specifier.

* gfortran.dg/fmt_zero_width.f90: Update test.

From-SVN: r278817

5 years agoRemove leftover optimize checks.
Jan Hubicka [Thu, 28 Nov 2019 17:51:40 +0000 (18:51 +0100)]
Remove leftover optimize checks.

* ipa-inline.c (want_early_inline_function_p): Remove leftover optimize
checks.

From-SVN: r278816

5 years agoprofile-count.c (profile_count::combine_with_ipa_count): Return uninitialized count...
Jan Hubicka [Thu, 28 Nov 2019 17:04:41 +0000 (18:04 +0100)]
profile-count.c (profile_count::combine_with_ipa_count): Return uninitialized count if called on ininitialized count.

* profile-count.c (profile_count::combine_with_ipa_count): Return
uninitialized count if called on ininitialized count.

From-SVN: r278815

5 years agoPrevent inconsistent profiles to be created in inlin_transform
Jan Hubicka [Thu, 28 Nov 2019 16:59:43 +0000 (17:59 +0100)]
Prevent inconsistent profiles to be created in inlin_transform

* ipa-inline-transform.c (inline_transform): Scale profile before
redirecting.

From-SVN: r278814