Steven G. Kargl [Wed, 2 Oct 2019 17:17:55 +0000 (17:17 +0000)]
re PR fortran/91784 (ICE in gfc_real2complex, at fortran/arith.c:2208)
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91784
* simplify.c (gfc_convert_constant): Simplify expression if the
expres ion type is EXPR_OP.
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91784
* gfortran.dg/pr91784.f90: New test.
From-SVN: r276474
Steven G. Kargl [Wed, 2 Oct 2019 17:09:45 +0000 (17:09 +0000)]
re PR fortran/91785 (ICE in check_assumed_size_reference, at fortran/resolve.c:1601)
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91785
* primary.c (gfc_match_varspec): Ensure an inquiry parameter has
it locus set.
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91785
* gfortran.dg/pr91785.f90: New test.
From-SVN: r276473
Steven G. Kargl [Wed, 2 Oct 2019 17:04:57 +0000 (17:04 +0000)]
re PR fortran/91942 (ICE in match_vtag, at fortran/io.c:1485)
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91942
* io.c (match_vtag): Check for non-NULL result->symtree.
(match_out_tag): Check for invalid constant due to inquiry parameter.
(match_filepos): Instead of a syntax error, go to cleanup to get better
error messages.
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91942
* gfortran.dg/pr91587.f90: Update dg-error regex.
* gfortran.dg/pr91942.f90: New test.
From-SVN: r276472
Steven G. Kargl [Wed, 2 Oct 2019 17:01:30 +0000 (17:01 +0000)]
re PR fortran/91943 (ICE in gfc_conv_constant_to_tree, at fortran/trans-const.c:370)
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91943
* match.c (gfc_match_call): BOZ cannot be an actual argument in
a subroutine reference.
* resolve.c (resolve_function): BOZ cannot be an actual argument in
a function reference.
2019-10-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91943
gfortran.dg/pr91943.f90
From-SVN: r276471
Jan Hubicka [Wed, 2 Oct 2019 16:02:16 +0000 (16:02 +0000)]
cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT, [...]): New.
* cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT,
MAX_INLINE_INSNS_AUTO_O2_LIMIT): New.
* ipa-inline.c (inline_insns_single, inline_insns_auto): New functions.
(can_inline_edge_by_limits_p): Use it.
(big_speedup_p): Use PARAM_INLINE_MIN_SPEEDUP_O2.
(want_inline_small_function_p): Use O2 bounds.
(edge_badness): LIkewise.
* opts.c (default_options): Add OPT_finline_functions.
* params.def (PARAM_INLINE_MIN_SPEEDUP_O2,
PARAM_MAX_INLINE_INSNS_SINGLE_O2, PARAM_MAX_INLINE_INSNS_AUTO_O2):
New parameters.
* g++.dg/tree-ssa/pr53844.C: Add -fno-inline-functions --param
max-inline-insns-single-O2=200.
* gcc.c-torture/execute/builtins/builtins.exp: Add
-fno-inline-functions to additional_flags.
* gcc.dg/ipa/inline-7.c: Add -fno-inline-functions.
* gcc.dg/optimize-bswapsi-5.c: Add -fno-inline-functions.
* gcc.dg/tree-ssa/ssa-thread-12.c: Add --param
early-inlining-insns-O2=14 -fno-inline-functions; revert previous
change.
* gcc.dg/winline-3.c: Use --param max-inline-insns-single-O2=1
--param inline-min-speedup-O2=100
instead of --param max-inline-insns-single=1 --param
inline-min-speedup=100
* invoke.texi (-finline-functions): Update documentation.
(max-inline-insns-single-O2, max-inline-insns-auto-O2,
inline-min-speedup-O2): Document.
(early-inlining-insns-O2): Simplify docs.
From-SVN: r276470
Jan Hubicka [Wed, 2 Oct 2019 16:01:47 +0000 (16:01 +0000)]
cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT, [...]): New.
* cif-code.def (MAX_INLINE_INSNS_SINGLE_O2_LIMIT,
MAX_INLINE_INSNS_AUTO_O2_LIMIT): New.
* ipa-inline.c (inline_insns_single, inline_insns_auto): New functions.
(can_inline_edge_by_limits_p): Use it.
(big_speedup_p): Use PARAM_INLINE_MIN_SPEEDUP_O2.
(want_inline_small_function_p): Use O2 bounds.
(edge_badness): LIkewise.
* opts.c (default_options): Add OPT_finline_functions.
* params.def (PARAM_INLINE_MIN_SPEEDUP_O2,
PARAM_MAX_INLINE_INSNS_SINGLE_O2, PARAM_MAX_INLINE_INSNS_AUTO_O2):
New parameters.
* g++.dg/tree-ssa/pr53844.C: Add -fno-inline-functions --param
max-inline-insns-single-O2=200.
* gcc.c-torture/execute/builtins/builtins.exp: Add
-fno-inline-functions to additional_flags.
* gcc.dg/ipa/inline-7.c: Add -fno-inline-functions.
* gcc.dg/optimize-bswapsi-5.c: Add -fno-inline-functions.
* gcc.dg/tree-ssa/ssa-thread-12.c: Add --param
early-inlining-insns-O2=14 -fno-inline-functions; revert previous
change.
* gcc.dg/winline-3.c: Use --param max-inline-insns-single-O2=1
--param inline-min-speedup-O2=100
instead of --param max-inline-insns-single=1 --param
inline-min-speedup=100
* invoke.texi (-finline-functions): Update documentation.
(max-inline-insns-single-O2, max-inline-insns-auto-O2,
inline-min-speedup-O2): Document.
(early-inlining-insns-O2): Simplify docs.
From-SVN: r276469
Jonathan Wakely [Wed, 2 Oct 2019 15:52:41 +0000 (16:52 +0100)]
Remove greedy wildcards from libstdc++ linker script
The only symbols matched by std::e[a-q]* and std::e[s-z]* that are
supposed to be in the GLIBCXX_3.4 version are std::exception::* and
std::endl and std::ends. The latter two already have explicit patterns
matching them, so we just need to match std::exception::*.
This change ensures that any new symbols with a return type of
std::enable_if<...> are not added to the GLIBCXX_3.4 version.
* config/abi/pre/gnu.ver: Tighten up greedy wildcards.
From-SVN: r276468
Alexander Monakov [Wed, 2 Oct 2019 15:37:12 +0000 (18:37 +0300)]
ifcvt: improve cost estimation (PR 87047)
PR rtl-optimization/87047
* ifcvt.c (average_cost): New static function. Use it...
(noce_process_if_block): ... here.
testsuite/
* gcc.dg/pr87047.c: New test.
From-SVN: r276466
Martin Jambor [Wed, 2 Oct 2019 15:09:37 +0000 (17:09 +0200)]
[PR testsuite/91842] Skip gcc.dg/ipa/ipa-sra-19.c on power
2019-10-02 Martin Jambor <mjambor@suse.cz>
PR testsuite/91842
* gcc.dg/ipa/ipa-sra-19.c: Skip on powerpc.
From-SVN: r276465
Jan Hubicka [Wed, 2 Oct 2019 15:07:52 +0000 (15:07 +0000)]
module.c (load_commons): Initialize flags to 0 to silecne -Wmaybe-uninitialized warning.
* module.c (load_commons): Initialize flags to 0 to silecne
-Wmaybe-uninitialized warning.
(read_module): Likewise for n and comp_name.
From-SVN: r276464
Jonathan Wakely [Wed, 2 Oct 2019 14:56:57 +0000 (15:56 +0100)]
Document non-conformance of parallel mode to recent C++ standards
* doc/xml/manual/parallel_mode.xml: Add caveat about support for
recent standards.
* doc/html/*: Regenerate.
From-SVN: r276463
Aaron Sawdey [Wed, 2 Oct 2019 14:26:09 +0000 (14:26 +0000)]
rs6000-protos.h (expand_block_move): Change prototype.
2019-10-02 Aaron Sawdey <acsawdey@linux.ibm.com>
* config/rs6000/rs6000-protos.h (expand_block_move): Change prototype.
* config/rs6000/rs6000-string.c (expand_block_move): Add
might_overlap parm.
* config/rs6000/rs6000.md (movmemsi): Add new pattern.
(cpymemsi): Add might_overlap parm to expand_block_move() call.
From-SVN: r276462
Aaron Sawdey [Wed, 2 Oct 2019 14:23:51 +0000 (14:23 +0000)]
builtins.c (expand_builtin_memory_copy_args): Add might_overlap parm.
2019-10-02 Aaron Sawdey <acsawdey@linux.ibm.com>
* builtins.c (expand_builtin_memory_copy_args): Add might_overlap parm.
(expand_builtin_memcpy): Use might_overlap parm.
(expand_builtin_mempcpy_args): Use might_overlap parm.
(expand_builtin_memmove): Call expand_builtin_memory_copy_args.
(expand_builtin_memory_copy_args): Add might_overlap parm.
* expr.c (emit_block_move_via_cpymem): Rename to
emit_block_move_via_pattern, add might_overlap parm, use cpymem
or movmem optab as appropriate.
(emit_block_move_hints): Add might_overlap parm, do the right
thing for might_overlap==true.
* expr.h (emit_block_move_hints): Update prototype.
From-SVN: r276461
Eric Botcazou [Wed, 2 Oct 2019 13:35:40 +0000 (13:35 +0000)]
tree-eh.h (unsplit_eh_edges): Declare.
* tree-eh.h (unsplit_eh_edges): Declare.
* tree-eh.c (maybe_remove_unreachable_handlers): Detect more cases.
(unsplit_eh_edges): New function wrapping unsplit_all_eh.
* gimple-ssa-store-merging.c: Include cfganal.h cfgcleanup.h except.h.
(struct store_immediate_info): Add lp_nr field.
(store_immediate_info::store_immediate_info): Add NR2 parameter and
initialize lp_nr with it.
(struct merged_store_group): Add lp_nr and only_constants fields.
(merged_store_group::merged_store_group): Initialize them.
(merged_store_group::can_be_merged_into): Deal with them.
(pass_store_merging): Rename terminate_and_release_chain into
terminate_and_process_chain.
(pass_store_merging::terminate_and_process_all_chains): Adjust to above
renaming and remove useless assertions.
(pass_store_merging::terminate_all_aliasing_chains): Small tweak.
(stmts_may_clobber_ref_p): Be prepared for different basic blocks.
(imm_store_chain_info::coalesce_immediate_stores): Use only_constants
instead of always recomputing it and compare lp_nr.
(imm_store_chain_info::output_merged_store): If the group is in an
active EH region, register new stores if they can throw. Moreover,
if the insertion has created new basic blocks, adjust the PHI nodes
of the post landing pad.
(imm_store_chain_info::output_merged_stores): If the original stores
are in an active EH region, deregister them.
(lhs_valid_for_store_merging_p): Prettify.
(adjust_bit_pos): New function extracted from...
(mem_valid_for_store_merging): ...here. Use it for the base address
and also for the offset if it is the addition of a constant.
(lp_nr_for_store): New function.
(pass_store_merging::process_store): Change return type to bool.
Call lp_nr_for_store to initialize the store info. Propagate the
return status of various called functions to the return value.
(store_valid_for_store_merging_p): New predicate.
(enum basic_block_status): New enumeration.
(get_status_for_store_merging): New function.
(pass_store_merging::execute): If the function can throw and catch
non-call exceptions, unsplit the EH edges on entry and clean up the
CFG on exit if something changed. Call get_status_for_store_merging
for every basic block and keep the chains open across basic blocks
when possible. Terminate and process open chains at the end, if any.
From-SVN: r276459
Richard Sandiford [Wed, 2 Oct 2019 13:12:37 +0000 (13:12 +0000)]
Fix shadowing in globalize_reg
2019-10-02 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* reginfo.c (globalize_reg): Fix shadowed variable in
function_abis walk.
From-SVN: r276457
Richard Sandiford [Wed, 2 Oct 2019 13:11:45 +0000 (13:11 +0000)]
Fix MIPS call-clobbered-*.c tests
Jeff pointed out that gcc.target/mips/call-clobbered-4.c started
failing after the function-abi series. This is because IRA used
to treat partly call-clobbered registers as hard conflicts and
so wouldn't consider them for -fcaller-saves. Now that we treat
call clobbers the same way regardless of where they come from,
we can use $f21 as a caller-save register. This in turn means
that -Os is no longer a special case in call-clobbered-3.c.
(The new code is the same size as the old code.)
2019-10-02 Richard Sandiford <richard.sandiford@arm.com>
gcc/testsuite/
* gcc.target/mips/call-clobbered-3.c: Remove skip for -Os.
* gcc.target/mips/call-clobbered-4.c: Delete.
From-SVN: r276456
Martin Jambor [Wed, 2 Oct 2019 12:44:35 +0000 (14:44 +0200)]
[PATCH] Do not check call type compatibility when cloning cgraph-edges
2019-10-02 Martin Jambor <mjambor@suse.cz>
* cgraph.c (symbol_table::create_edge): New parameter cloning_p,
do not compute some stuff when set.
(cgraph_node::create_edge): Likewise.
(cgraph_node::create_indirect_edge): Renamed last parameter to
coning_p and flipped its meaning, don't even calculate
inline_failed when set.
* cgraph.h (cgraph_node::create_edge): Add new parameter.
(symbol_table::::create_edge): Likewise.
(cgraph_node::create_indirect_edge): Rename last parameter, flip
the default value.
* cgraphclones.c (cgraph_edge::clone): Pass true cloning_p to all
call graph edge creating functions.
From-SVN: r276455
Jan Hubicka [Wed, 2 Oct 2019 12:41:36 +0000 (14:41 +0200)]
re PR c++/91222 (507.cactuBSSN_r build fails in warn_types_mismatch at ipa-devirt.c:1006 since r273571)
PR c++/91222
* ipa-devirt.c (warn_types_mismatch): Fix conditional on anonymous
namespace types.
From-SVN: r276454
Shahab Vahedi [Wed, 2 Oct 2019 11:26:15 +0000 (11:26 +0000)]
[ARC] Pass along "-mcode-density" flag to "as"
This change makes sure that if the driver is invoked with
"-mcode-density" flag, then the assembler will receive it
too.
gcc/
xxxx-xx-xx Shahab Vahedi <shahab@synopsys.com>
* config/arc/arc.h (ASM_SPEC): pass -mcode-density
From-SVN: r276453
Richard Biener [Wed, 2 Oct 2019 11:24:27 +0000 (11:24 +0000)]
tree-vectorizer.h (vect_transform_reduction): Declare.
2019-10-02 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (vect_transform_reduction): Declare.
* tree-vect-stmts.c (vect_transform_stmt): Use it.
* tree-vect-loop.c (vectorizable_reduction): Split out reduction
stmt transform to ...
(vect_transform_reduction): ... this.
From-SVN: r276452
Tobias Burnus [Wed, 2 Oct 2019 10:57:54 +0000 (10:57 +0000)]
Support OpenMP's use_device_addr in Fortran
gcc/fortran/
* dump-parse-tree.c (show_omp_clauses): Handle OMP_LIST_USE_DEVICE_ADDR.
* gfortran.h (enum): Add OMP_LIST_USE_DEVICE_ADDR.
* openmp.c (omp_mask1): Likewise.
(gfc_match_omp_clauses): Match 'use_device_addr'.
(OMP_TARGET_DATA_CLAUSES): Add OMP_LIST_USE_DEVICE_ADDR.
(resolve_omp_clauses): Add it; add is_device_ptr checks.
gcc/testsuite/
* gfortran.dg/gomp/is_device_ptr-1.f90: New.
From-SVN: r276449
Richard Biener [Wed, 2 Oct 2019 10:54:10 +0000 (10:54 +0000)]
re PR c++/91606 (Optimization leads to invalid code)
2019-10-02 Richard Biener <rguenther@suse.de>
PR c++/91606
* decl.c (build_ptrmemfunc_type): Mark pointer-to-member
fat pointer structure members as DECL_NONADDRESSABLE_P.
* g++.dg/torture/pr91606.C: New testcase.
From-SVN: r276448
Tobias Burnus [Wed, 2 Oct 2019 10:50:23 +0000 (10:50 +0000)]
Improve OMP/ACC error diagnostic in Fortran
gcc/fortran/
* openmp.c (gfc_match_omp_clauses): Show a clause-parsing
error if none was rised before.
* parse.c (matcha, matcho): If error occurred after
OpenMP/OpenACC directive matched, do not try other directives.
gcc/testsuite/
* gfortran.dg/goacc/asyncwait-1.f95: Handle new error message.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise
* gfortran.dg/goacc/asyncwait-3.f95: Likewise
* gfortran.dg/goacc/asyncwait-4.f95: Likewise
* gfortran.dg/goacc/default-2.f: Likewise
* gfortran.dg/goacc/enter-exit-data.f95: Likewise
* gfortran.dg/goacc/if.f95: Likewise
* gfortran.dg/goacc/list.f95: Likewise
* gfortran.dg/goacc/literal.f95: Likewise
* gfortran.dg/goacc/loop-2-kernels-tile.f: Likewise95
* gfortran.dg/goacc/loop-2-parallel-tile.f95: Likewise
* gfortran.dg/goacc/loop-7.f95: Likewise
* gfortran.dg/goacc/parallel-kernels-cla: Likewiseuses.f95
* gfortran.dg/goacc/routine-6.f90: Likewise
* gfortran.dg/goacc/several-directives.f95: Likewise
* gfortran.dg/goacc/sie.f95: Likewise
* gfortran.dg/goacc/tile-1.f90: Likewise
* gfortran.dg/goacc/update-if_present-2.: Likewisef90
* gfortran.dg/gomp/declare-simd-1.f90: Likewise
* gfortran.dg/gomp/pr29759.f90: Likewise
From-SVN: r276447
Tobias Burnus [Wed, 2 Oct 2019 10:41:59 +0000 (10:41 +0000)]
Fix coding style comment, missed in last commit
* trans-openmp.c (gfc_omp_is_optional_argument): Fix coding
style.
From-SVN: r276446
Tobias Burnus [Wed, 2 Oct 2019 10:33:42 +0000 (10:33 +0000)]
Fix omp target issue with Fortran optional arguments
gcc/
* omp-low.c (lower_omp_target): Dereference optional argument
to work with the right pointer.
gcc/testsuite/
* libgomp/testsuite/libgomp.fortran/use_device_ptr-optional-1.f90: New.
From-SVN: r276445
Kwok Cheung Yeung [Wed, 2 Oct 2019 10:31:02 +0000 (10:31 +0000)]
f95-lang.c (LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT): Define to gfc_omp_is_optional_argument.
2019-10-02 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/fortran/
* f95-lang.c (LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT): Define to
gfc_omp_is_optional_argument.
* trans-decl.c (create_function_arglist): Set
GFC_DECL_OPTIONAL_ARGUMENT in the generated decl if the parameter is
optional.
* trans-openmp.c (gfc_omp_is_optional_argument): New.
(gfc_omp_privatize_by_reference): Return true if the decl is an
optional pass-by-reference argument.
* trans.h (gfc_omp_is_optional_argument): New declaration.
(lang_decl): Add new optional_arg field.
(GFC_DECL_OPTIONAL_ARGUMENT): New macro.
gcc/
* langhooks-def.h (LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT): Default to
false.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_OMP_IS_OPTIONAL_ARGUMENT.
* langhooks.h (omp_is_optional_argument): New hook.
* omp-general.c (omp_is_optional_argument): New.
* omp-general.h (omp_is_optional_argument): New declaration.
* omp-low.c (lower_omp_target): Create temporary for received value
and take the address for new_var if the original variable was a
DECL_BY_REFERENCE. Use size of referenced object when a
pass-by-reference optional argument used as argument to firstprivate.
From-SVN: r276444
Richard Biener [Wed, 2 Oct 2019 10:22:05 +0000 (10:22 +0000)]
internal.h (enum include_type): Remove trailing comma.
2019-10-02 Richard Biener <rguenther@suse.de>
* internal.h (enum include_type): Remove trailing comma.
From-SVN: r276443
Jakub Jelinek [Wed, 2 Oct 2019 10:18:50 +0000 (12:18 +0200)]
re PR tree-optimization/91940 (__builtin_bswap16 loop optimization)
PR tree-optimization/91940
* tree-vect-patterns.c: Include tree-vector-builder.h and
vec-perm-indices.h.
(vect_recog_rotate_pattern): Also handle __builtin_bswap16, either by
unpromoting the argument back to uint16_t, or by converting into a
rotate, or into shifts plus ior.
* gcc.dg/vect/vect-bswap16.c: Add -msse4 on x86, run on all targets,
expect vectorized 1 loops message on both vect_bswap and sse4_runtime
targets.
* gcc.dg/vect/vect-bswap16a.c: New test.
From-SVN: r276442
Richard Biener [Wed, 2 Oct 2019 09:21:57 +0000 (09:21 +0000)]
tree-vectorizer.h (stmt_vec_info_type::cycle_phi_info_type): New.
2019-10-02 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (stmt_vec_info_type::cycle_phi_info_type):
New.
(vect_transform_cycle_phi): Declare.
* tree-vect-stmts.c (vect_transform_stmt): Call
vect_transform_cycle_phi.
* tree-vect-loop.c (vectorizable_reduction): Split out
PHI transformation stage to ...
(vect_transform_cycle_phi): ... here.
From-SVN: r276441
Richard Sandiford [Wed, 2 Oct 2019 07:37:10 +0000 (07:37 +0000)]
[LRA] Don't make eliminable registers live (PR91957)
One effect of https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00802.html
was to strengthen the sanity check in lra_assigns so that it checks
whether reg_renumber is consistent with the whole conflict set.
This duly tripped on csky for a pseudo that had been allocated
to the eliminated frame pointer. (csky doesn't have a separate
hard frame pointer.)
lra-lives uses:
/* Set of hard regs (except eliminable ones) currently live. */
static HARD_REG_SET hard_regs_live;
to track the set of live directly-referenced hard registers, and it
correctly implements the exclusion when setting up the initial set:
hard_regs_live &= ~eliminable_regset;
But later calls to make_hard_regno_live and make_hard_regno_dead
would process eliminable registers like other registers, recording
conflicts for them and potentially making them live. (Note that
after r266086, make_hard_regno_dead adds conflicts for registers
that are already marked dead.) I think this would have had the
effect of pessimising targets without a separate hard frame pointer.
2019-10-02 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR middle-end/91957
* lra-lives.c (make_hard_regno_dead): Don't record conflicts for
eliminable registers.
(make_hard_regno_live): Likewise, and don't make them live.
From-SVN: r276440
Jerry DeLisle [Wed, 2 Oct 2019 02:35:14 +0000 (02:35 +0000)]
re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)
2019-10-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/91593
* io/read.c (read_decimal): Cast constant to size_t to turn off
a bogus warning.
* io/write.c (btoa_big): Use memset in lieu of setting the null
byte in a string buffer to turn off a bogus warning.
From-SVN: r276439
GCC Administrator [Wed, 2 Oct 2019 00:16:19 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r276438
Joseph Myers [Wed, 2 Oct 2019 00:08:40 +0000 (01:08 +0100)]
Handle :: tokens in C for C2x.
As part of adding [[]]-style attributes, C2x adds the token :: for use
in scoped attribute names.
This patch adds corresponding support for that token in C to GCC. The
token is supported both for C2x and for older gnu* standards (on the
basis that extensions are normally supported in older gnu* versions;
people will expect to be able to use [[]] attributes, before C2x is
the default, without needing to use -std=gnu2x).
There are no cases in older C standards where the token : can be
followed by a token starting with : in syntactically valid sources;
the only cases the :: token could break in older standard C thus are
ones involving concatenation of pp-tokens where the result does not
end up as tokens (e.g., gets stringized). In GNU C extensions, the
main case where :: might appear in existing sources is in asm
statements, and the C parser is thus made to handle it like two
consecutive : tokens, which the C++ parser already does. A limited
test of various positionings of :: in asm statements is added to the
testsuite (in particular, to cover the syntax error when :: means too
many colons but a single : would be OK), but existing tests cover a
variety of styles there anyway.
Technically there are cases in Objective-C and OpenMP for which this
also changes how previously valid code is lexed: the objc-selector-arg
syntax allows multiple consecutive : tokens (although I don't think
they are particularly useful there), while OpenMP syntax includes
array section syntax such as [:] which, before :: was a token, could
also be written as [::> (there might be other OpenMP cases potentially
affected, I didn't check all the OpenMP syntax in detail). I don't
think either of those cases affects the basis for supporting the ::
token in all -std=gnu* modes, or that there is any obvious need to
special-case handling of CPP_SCOPE tokens for those constructs the way
there is for asm statements.
cpp_avoid_paste, which determines when spaces need adding between
tokens in preprocessed output where there wouldn't otherwise be
whitespace between them (e.g. if stringized), already inserts space
between : and : unconditionally, rather than only for C++, so no
change is needed there (but a C2x test is added that such space is
indeed inserted).
Bootstrapped with no regressions on x86-64-pc-linux-gnu.
gcc/c:
* c-parser.c (c_parser_asm_statement): Handle CPP_SCOPE like two
CPP_COLON tokens.
gcc/testsuite:
* gcc.dg/asm-scope-1.c, gcc.dg/cpp/c11-scope-1.c,
gcc.dg/cpp/c17-scope-1.c, gcc.dg/cpp/c2x-scope-1.c,
gcc.dg/cpp/c2x-scope-2.c, gcc.dg/cpp/c90-scope-1.c,
gcc.dg/cpp/c94-scope-1.c, gcc.dg/cpp/c99-scope-1.c,
gcc.dg/cpp/gnu11-scope-1.c, gcc.dg/cpp/gnu17-scope-1.c,
gcc.dg/cpp/gnu89-scope-1.c, gcc.dg/cpp/gnu99-scope-1.c: New tests.
libcpp:
* include/cpplib.h (struct cpp_options): Add member scope.
* init.c (struct lang_flags, lang_defaults): Likewise.
(cpp_set_lang): Set scope member of pfile.
* lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not
CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens.
From-SVN: r276434
David Malcolm [Tue, 1 Oct 2019 21:58:17 +0000 (21:58 +0000)]
Support prefixes in diagnostic_show_locus
Previously, diagnostic_show_locus saved and restored the pretty_printer's
prefix, clearing it for the duration of the call.
I have a patch kit in development that can benefit from applying a prefix
to the output of d_s_l, so this patch adds support to d_s_l for printing
such prefixes.
It moves the save and restore of the pp's prefix from d_s_l to all of its
callers, and updates diagnostic-show-locus.c to properly handle prefixes.
gcc/c-family/ChangeLog:
* c-opts.c (c_diagnostic_finalizer): Temporarily clear prefix when
calling diagnostic_show_locus, rather than destroying it afterwards.
gcc/ChangeLog:
* diagnostic-show-locus.c (layout::print_gap_in_line_numbering):
Call pp_emit_prefix.
(layout::print_source_line): Likewise.
(layout::start_annotation_line): Likewise.
(diagnostic_show_locus): Remove call to temporarily clear the
prefix.
(selftest::test_one_liner_fixit_remove): Add test coverage for the
interaction of pp_set_prefix with rulers and fix-it hints.
* diagnostic.c (default_diagnostic_finalizer): Temporarily clear
prefix when calling diagnostic_show_locus, rather than destroying
it afterwards.
(print_parseable_fixits): Temporarily clear prefix.
* pretty-print.c (pp_format): Save and restore line_length, rather
than assuming it is zero.
(pp_output_formatted_text): Remove assertion that line_length is
zero.
gcc/fortran/ChangeLog:
* error.c (gfc_diagnostic_starter): Clear the prefix before
calling diagnostic_show_locus.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_group_plugin.c (test_begin_group_cb):
Clear the prefix before emitting the "END GROUP" line.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(custom_diagnostic_finalizer): Temporarily clear prefix when
calling diagnostic_show_locus, rather than destroying it
afterwards.
From-SVN: r276433
Jonathan Wakely [Tue, 1 Oct 2019 21:02:27 +0000 (22:02 +0100)]
Make some new algorithms work in parallel mode
* include/experimental/algorithm (experimental::sample): Qualify call
to __sample correctly.
* include/parallel/algo.h (sample, for_each_n): Add using-declarations
for algorithms that don't have parallel implementations.
From-SVN: r276432
Jonathan Wakely [Tue, 1 Oct 2019 21:02:22 +0000 (22:02 +0100)]
Make some parallel mode algorithms usable in constexpr contexts
This makes the __parallel::equal and __parallel:lexicographical_compare
algorithms usable in constant expressions, by dispatching to the
sequential algorithm when calling during constant evaluation.
* include/parallel/algobase.h (equal, lexicographical_compare): Add
_GLIBCXX20_CONSTEXPR and dispatch to sequential algorithm when being
constant evaluated.
* include/parallel/algorithmfwd.h (equal, lexicographical_compare):
Add _GLIBCXX20_CONSTEXPR.
From-SVN: r276431
Jonathan Wakely [Tue, 1 Oct 2019 21:02:17 +0000 (22:02 +0100)]
Disable tests that aren't valid in parallel mode
Tests that depend on debug mode can't be tested in parallel mode.
* testsuite/17_intro/using_namespace_std_tr1_neg.cc: Skip test for
parallel mode.
* testsuite/20_util/hash/84998.cc: Likewise.
* testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/list/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/map/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/multimap/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/multiset/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/set/pmr_typedefs_debug.cc: Likewise.
* testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc:
Likewise.
* testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc:
Likewise.
* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
Likewise.
* testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: Likewise.
* testsuite/25_algorithms/binary_search/partitioned.cc: Likewise.
* testsuite/25_algorithms/copy/86658.cc: Likewise.
* testsuite/25_algorithms/equal_range/partitioned.cc: Likewise.
* testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise.
* testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise.
* testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise.
From-SVN: r276430
Jonathan Wakely [Tue, 1 Oct 2019 21:02:01 +0000 (22:02 +0100)]
Fix non-reserved names in Parallel Mode headers
* include/parallel/algo.h: Replace non-reserved names.
* include/parallel/multiway_merge.h: Likewise.
* include/parallel/multiway_mergesort.h: Likewise.
* include/parallel/numericfwd.h: Likewise.
* testsuite/17_intro/names.cc: Add RAI to test macros.
From-SVN: r276429
Maciej W. Rozycki [Tue, 1 Oct 2019 19:57:44 +0000 (19:57 +0000)]
Regenerate `liboffloadmic/plugin/configure' for r275564 ("[ARM/FDPIC v6 02/24] [ARM] FDPIC...
Regenerate `liboffloadmic/plugin/configure' for r275564 ("[ARM/FDPIC v6
02/24] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure
scripts") too.
liboffloadmic/
* plugin/configure: Regenerate.
From-SVN: r276428
Jan Hubicka [Tue, 1 Oct 2019 19:46:09 +0000 (21:46 +0200)]
tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p): Rename to ...
* tree-ssa-alias.c (nonoverlapping_component_refs_since_match_p):
Rename to ...
(nonoverlapping_refs_since_match_p): ... this; handle also
ARRAY_REFs.
(alias_stats): Update stats.
(dump_alias_stats): Likewise.
(cheap_array_ref_low_bound): New function.
(aliasing_matching_component_refs_p): Add partial_overlap
argument;
pass it to nonoverlapping_refs_since_match_p.
(aliasing_component_refs_walk): Update call of
aliasing_matching_component_refs_p
(nonoverlapping_array_refs_p): New function.
(decl_refs_may_alias_p, indirect_ref_may_alias_decl_p,
indirect_refs_may_alias_p): Update calls of
nonoverlapping_refs_since_match_p.
* gcc.dg/tree-ssa/alias-access-path-10.c: New testcase.
* gcc.dg/tree-ssa/alias-access-path-11.c: New testcase.
From-SVN: r276427
Maya Rashish [Tue, 1 Oct 2019 19:25:31 +0000 (19:25 +0000)]
re PR target/85401 (segfault building code for VAX)
PR target/85401
* ira-color.c (allocno_copy_cost_saving): Call
ira_init_register_move_cost_if_necessary.
From-SVN: r276426
Maciej W. Rozycki [Tue, 1 Oct 2019 19:14:11 +0000 (19:14 +0000)]
libada: Respect `--enable-version-specific-runtime-libs'
Respect the `--enable-version-specific-runtime-libs' configuration
option in libada/, so that shared gnatlib libraries will be installed
in non-version-specific $(toolexeclibdir) if requested. In a
cross-compilation environment this helps setting up a consistent
sysroot, which can then be shared between the host and the target
system.
This lets one have `libgnarl-10.so' and `libgnat-10.so' installed in say
/usr/lib and /usr/$(target_alias)/lib for a native and a cross-build
respectively, rather than in /usr/lib/gcc/$(target_alias)/10.0.0/adalib.
Update the settings of $(toolexecdir) and $(toolexeclibdir), unused till
now, to keep the current arrangement in the version-specific case and
make the new option to be enabled by default, unlike with the other
target libraries, so as to keep existing people's build infrastructure
unaffected.
Of course if someone does use `--disable-version-specific-runtime-libs'
already, then the installation location of shared gnatlib libraries will
change, but presumably this is what they do want anyway as the current
situation where the option is ignored in libada/ only is an anomaly
really rather than one that is expected or desired.
gcc/ada/
* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
(install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared
library installation.
libada/
* Makefile.in (toolexecdir, toolexeclibdir): New variables.
(LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'.
* configure.ac: Add `--enable-version-specific-runtime-libs'.
Update version-specific `toolexecdir' and `toolexeclibdir' from
ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in.
* configure: Regenerate.
From-SVN: r276424
Maciej W. Rozycki [Tue, 1 Oct 2019 18:38:58 +0000 (18:38 +0000)]
libada: Remove racy duplicate gnatlib installation
For some reason, presumably historical, the `install-gnatlib' target for
the default multilib is invoked twice, once via the `ada.install-common'
target in `gcc/ada/gcc-interface/Make-lang.in' invoked from gcc/ and
again via the `install-libada' target in libada/.
Apart from doing the same twice this is actually harmful in sufficiently
parallelized `make' invocation, as the removal of old files performed
within the `install-gnatlib' recipe in the former case actually races
with the installation of new files done in the latter case, causing the
recipe to fail and abort, however non-fatally, having not completed the
installation of all the built files needed for the newly-built compiler
to work correctly.
This can be observed with a native `x86_64-linux-gnu' bootstrap:
make[4]: Entering directory '.../gcc/ada'
rm -rf .../lib/gcc/x86_64-linux-gnu/10.0.0/adalib
rm: cannot remove '.../lib/gcc/x86_64-linux-gnu/10.0.0/adalib': Directory not empty
make[4]: *** [gcc-interface/Makefile:512: install-gnatlib] Error 1
make[4]: Leaving directory '.../gcc/ada'
make[3]: *** [.../gcc/ada/gcc-interface/Make-lang.in:853: install-gnatlib] Error 2
make[2]: [.../gcc/ada/gcc-interface/Make-lang.in:829: ada.install-common] Error 2 (ignored)
which then causes missing files to be reported when an attempt is made
to use the newly-installed non-functional compiler to build a
`riscv-linux-gnu' cross-compiler:
(cd ada/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h )
error: "ada.ali" not found, "ada.ads" must be compiled
error: "s-memory.ali" not found, "s-memory.adb" must be compiled
gnatmake: *** bind failed.
/bin/sh: ./xsinfo: No such file or directory
make[2]: *** [.../gcc/ada/Make-generated.in:45: ada/sinfo.h] Error 127
make[2]: Leaving directory '.../gcc'
make[1]: *** [Makefile:4369: all-gcc] Error 2
make[1]: Leaving directory '...'
make: *** [Makefile:965: all] Error 2
Depending on timing `.../lib/gcc/x86_64-linux-gnu/10.0.0/adainclude' may
cause an installation failure instead and the resulting compiler may be
non-functional in a different way.
Only invoke `install-gnatlib' from within gcc/ then if a legacy build
process is being used with libada disabled and gnatlib built manually
with `make -C gcc gnatlib'.
gcc/
* Makefile.in (gnat_install_lib): New variable.
* configure.ac: Substitute it.
* configure: Regenerate.
gcc/ada/
* gcc-interface/Make-lang.in (ada.install-common): Split into...
(gnat-install-tools, gnat-install-lib): ... these.
From-SVN: r276422
Jan Hubicka [Tue, 1 Oct 2019 18:21:31 +0000 (20:21 +0200)]
re PR c++/91222 (507.cactuBSSN_r build fails in warn_types_mismatch at ipa-devirt.c:1006 since r273571)
PR lto/91222
* ipa-devirt.c (warn_types_mismatch): Do not ICE when anonymous type
is matched with non-C++ type
* g++.dg/lto/odr-6_0.C: New testcase.
* g++.dg/lto/odr-6_1.c: New testcase.
From-SVN: r276420
Jan Hubicka [Tue, 1 Oct 2019 18:03:13 +0000 (20:03 +0200)]
ssa-thread-12.c: Fix warning introduced by my previous change.
* gcc.dg/tree-ssa/ssa-thread-12.c: Fix warning introduced by my
previous change.
From-SVN: r276418
Prathamesh Kulkarni [Tue, 1 Oct 2019 17:10:01 +0000 (17:10 +0000)]
tree-if-conv.c (tree_if_conversion): Move call to ifcvt_local_dce after local CSE.
2019-10-01 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* tree-if-conv.c (tree_if_conversion): Move call to ifcvt_local_dce
after local CSE.
From-SVN: r276417
Jan Hubicka [Tue, 1 Oct 2019 16:58:35 +0000 (18:58 +0200)]
invoke.texi (early-inlining-insns-O2): Document.
* doc/invoke.texi (early-inlining-insns-O2): Document.
(early-inlining-insns): Update.
* params.def (early-inlining-insns-O2): New bound.
(early-inlining-insns): Update docs.
* ipa-inline.c (want_early_inline_function_p): Use new bound.
* g++.dg/tree-ssa/pr61034.C: Set early-inlining-insns-O2=14.
* g++.dg/tree-ssa/pr8781.C: Likewise.
* g++.dg/warn/Wstringop-truncation-1.C: Likewise.
* gcc.dg/ipa/pr63416.c: likewise.
* gcc.dg/vect/pr66142.c: Likewise.
* gcc.dg/tree-ssa/ssa-thread-12.c: Mark compure_idf inline.
From-SVN: r276416
Jakub Jelinek [Tue, 1 Oct 2019 16:19:04 +0000 (18:19 +0200)]
re PR c++/91925 (-fpack-struct causes a decltype with template to ICE)
PR c++/91925
* c-warn.c (check_alignment_of_packed_member): Ignore FIELD_DECLs
with NULL DECL_FIELD_OFFSET.
* g++.dg/conversion/packed2.C: New test.
From-SVN: r276415
Oleg Endo [Tue, 1 Oct 2019 14:55:34 +0000 (14:55 +0000)]
re PR c++/88562 (Incorrect pointer incrementing on SH4)
gcc/
2019-10-01 Oleg Endo <olegendo@gcc.gnu.org>
PR target/88562
* config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Use
sh_check_add_incdec_notes to preserve REG_INC notes when replacing
a memory access insn.
From-SVN: r276411
William Schmidt [Tue, 1 Oct 2019 14:27:44 +0000 (14:27 +0000)]
rs6000-p8swap.c (rtx_is_swappable_p): Don't swap vpmsumd.
[gcc]
2019-10-01 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Don't swap
vpmsumd.
[gcc/testsuite]
2019-10-01 Bill Schmidt <wschmdit@linux.ibm.com>
* gcc.target/powerpc/pr91275.c: New.
From-SVN: r276410
Ilya Leoshkevich [Tue, 1 Oct 2019 14:04:08 +0000 (14:04 +0000)]
S/390: Remove code duplication in vec_* comparison expanders
s390.md uses a lot of near-identical expanders that perform dispatching
to other expanders based on operand types. Since the following patch
would require even more of these, avoid copy-pasting the code by
generating these expanders using an iterator.
gcc/ChangeLog:
2019-10-01 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/77918
* config/s390/s390.c (s390_expand_vec_compare): Use
gen_vec_cmpordered and gen_vec_cmpunordered.
* config/s390/vector.md (vec_cmpuneq, vec_cmpltgt, vec_ordered,
vec_unordered): Delete.
(vec_ordered<mode>): Rename to vec_cmpordered<mode>.
(vec_unordered<mode>): Rename to vec_cmpunordered<mode>.
(VEC_CMP_EXPAND): New iterator for the generic dispatcher.
(vec_cmp<code>): Generic dispatcher.
From-SVN: r276409
Ilya Leoshkevich [Tue, 1 Oct 2019 14:03:08 +0000 (14:03 +0000)]
S/390: Implement vcond expander for V1TI,V1TF
Currently gcc does not emit wf{c,k}* instructions when comparing long
double values. Middle-end actually adds them in the first place, but
then veclower pass replaces them with floating point register pair
operations, because the corresponding expander is missing.
gcc/ChangeLog:
2019-10-01 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/77918
* config/s390/vector.md (V_HW): Add V1TI in order to make
vcond$a$b generate vcondv1tiv1tf.
From-SVN: r276408
Richard Sandiford [Tue, 1 Oct 2019 12:55:16 +0000 (12:55 +0000)]
Fix reload after function-abi patches (PR91948)
The code was passing a pseudo rather than its allocated hard reg
to ira_need_caller_save_p. Running under valgrind to reproduce
the failure also showed that ALLOCNO_CROSSED_CALLS_ABIS wasn't
being explicitly initialised.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR rtl-optimization/91948
* ira-build.c (ira_create_allocno): Initialize
ALLOCNO_CROSSED_CALLS_ABIS.
* ira-color.c (allocno_reload_assign): Pass hard_regno rather
than regno to ira_need_caller_save_p.
From-SVN: r276407
Alexandre Oliva [Tue, 1 Oct 2019 11:37:01 +0000 (11:37 +0000)]
recompute opt flags after opt level change
flag_omit_frame_pointer is set in machine-independent code depending
on the optimization level. It is then overridden in x86
target-specific code depending on a macro defined by
--enable-frame-pointer.
Uses of attribute optimize go through machine-independent overriding
of flag_omit_frame_pointer, but the x86-specific overriding code did
NOT cover this flag, so, even if the attribute does not change the
optimization level, flag_omit_frame_pointer may end up with a
different value, and prevent inlining because of incompatible flags,
as detected by the gcc.dg/ipa/iinline-attr.c test on an
--enable-frame-pointer x86 toolchain.
for gcc/ChangeLog
* config/i386/i386-options.c
(ix86_recompute_optlev_based_flags): New, moved out of...
(ix86_option_override_internal): ... this. Call it.
(ix86_override_options_after_change): Call it here too.
From-SVN: r276405
Alexandre Oliva [Tue, 1 Oct 2019 11:36:47 +0000 (11:36 +0000)]
Store float for pow result test
Optimizing gcc.dg/torture/pr41094.c, the compiler computes the
constant value and short-circuits the whole thing. At -O0, however,
on 32-bit x86, the call to pow() remains, and the program compares the
returned value in a stack register, with excess precision, with the
exact return value expected from pow(). If libm's pow() returns a
slightly off result, the compare fails. If the value in the register
is stored in a separate variable, so it gets rounded to double
precision, and then compared, the compare passes.
It's not clear that the test was meant to detect libm's reliance on
rounding off the excess precision, but I guess it wasn't, so I propose
this slight change that enables it to pass regardless of the slight
inaccuracy of the C library in use.
for gcc/testsuite/ChangeLog
* gcc.dg/torture/pr41094.c: Introduce intermediate variable.
From-SVN: r276404
Alexandre Oliva [Tue, 1 Oct 2019 11:36:31 +0000 (11:36 +0000)]
DWARF array bounds missing from C++ array definitions
A variable redeclaration or definition that provides additional type
information for it, e.g. outermost array bounds, is not reflected in
the debug information for the variable. With this patch, the debug
info of the variable specialization gets a type attribute with the
adjusted type.
This patch affects mostly only array bounds. However, when the
symbolic type used in a declaration and in a definition are different,
although they refer to the same type, debug information will end up
(correctly?) naming different symbolic types in the specification and
the definition. Also, when a readonly declaration of an array loses
the readonly flag at the definition because of the initializer, the
definition may end up referencing a type while the specification
refers to a const-qualified version of that type. If the type of the
variable is already const-qualified, e.g. an array of a const type,
the difference is meaningless.
for gcc/ChangeLog
PR debug/91507
* dwarf2out.c (override_type_for_decl_p): New.
(gen_variable_die): Use it.
for gcc/testsuite/ChangeLog
PR debug/91507
* gcc.dg/debug/dwarf2/array-0.c: New.
* gcc.dg/debug/dwarf2/array-1.c: New.
* gcc.dg/debug/dwarf2/array-2.c: New.
* gcc.dg/debug/dwarf2/array-3.c: New.
* g++.dg/debug/dwarf2/array-0.C: New.
* g++.dg/debug/dwarf2/array-1.C: New.
* g++.dg/debug/dwarf2/array-2.C: New. Based on libstdc++-v3's
src/c++98/pool_allocator.cc:__pool_alloc_base::_S_heap_size.
* g++.dg/debug/dwarf2/array-3.C: New. Based on
gcc's config/i386/i386-features.c:xlogue_layout::s_instances.
* g++.dg/debug/dwarf2/array-4.C: New.
From-SVN: r276403
Richard Biener [Tue, 1 Oct 2019 11:20:27 +0000 (11:20 +0000)]
tree-vect-loop.c (vectorizable_reduction): Move variables to where they are used.
2019-10-01 Richard Biener <rguenther@suse.de>
* tree-vect-loop.c (vectorizable_reduction): Move variables
to where they are used.
From-SVN: r276402
Segher Boessenkool [Tue, 1 Oct 2019 11:12:03 +0000 (13:12 +0200)]
regrename: Use PC instead of CC0 to hide operands
The regrename pass temporarily changes some operand RTL to CC0 so that
note_stores and scan_rtx don't see those operands. CC0 is deprecated
and we want to remove it, so we need to use something else here.
PC fits the bill fine.
* regrename.c (hide_operands): Use pc_rtx instead of cc0_rtx.
(build_def_use): Use PC instead of CC0 in a comment.
From-SVN: r276401
Frederik Harwath [Tue, 1 Oct 2019 09:50:44 +0000 (09:50 +0000)]
Add myself to MAINTAINERS file
2019-10-01 Frederik Harwath <frederik@codesourcery.com>
* MAINTAINERS: Add myself to Write After Approval
From-SVN: r276396
Richard Sandiford [Tue, 1 Oct 2019 08:56:25 +0000 (08:56 +0000)]
[C] Avoid aka types that just add tags
diag-aka-1.c tests that:
struct T { int i; } T;
void *a;
T *t = a;
produces:
request for implicit conversion from 'void *' to 'T *' {aka 'struct T *'} ...
But printing an aka for the tag seems a bit redundant when the tag name
is the same as the typedef name. It's probably not going to be telling
the user anything they don't already know, and can be distracting if "T"
rather than "struct T" is the preferred choice for an exported interface.
This is even more true if the tag is anonymous; e.g.:
struct { int i; } T;
void *a;
T *t = a;
gives:
request for implicit conversion from 'void *' to 'T *' {aka 'struct <anonymous> *'}
Rather than just drop the test above, the patch instead tests for:
struct T { int i; } *T;
where seeing the tag definitely helps.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/c/
* c-objc-common.c (useful_aka_type_p): New function.
(print_type): Use it to decide whether an aka type is worth printing.
gcc/testsuite/
* gcc.dg/diag-aka-1.c (T): Turn into a pointer typedef.
(foo): Update accordingly.
* gcc.dg/diag-aka-4.c: New test.
From-SVN: r276395
Richard Sandiford [Tue, 1 Oct 2019 08:56:12 +0000 (08:56 +0000)]
[C] Improve diagnostics for vector types
Given the following invalid arm_neon.h-based code:
float x;
int8x8_t y = x;
the error message we emit is pretty good:
incompatible types when initializing type 'int8x8_t' using type 'float'
But convert the types to pointers:
int8x8_t *ptr = &x;
and the message becomes:
initialization of '__vector(8) signed char *' from incompatible pointer type 'float *'
Although it's reasonably obvious what '__vector(8) signed char *' means,
it isn't valid C or C++ syntax and is quite far from what the user wrote,
so using 'int8x8_t *' would be better.
This patch therefore prints the type name of vectors that have one.
It's still OK to print the __vector syntax as an "aka", although I have
a follow-on patch to tweak this slightly for types defined in system
header files. The follow-on patch also addresses the ??? in
gcc.target/aarch64/diag_aka_1.c.
The C++ test already passed, but it seemed worth including for
consistency.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/c-family/
* c-pretty-print.c (pp_c_specifier_qualifier_list): If a vector type
has a type name, use it in preference to the __vector syntax.
gcc/testsuite/
* gcc.dg/diag-aka-3.c: New test.
* gcc.target/aarch64/diag_aka_1.c: New test.
* g++.dg/diagnostic/aka4.C: New test.
From-SVN: r276394
Richard Sandiford [Tue, 1 Oct 2019 08:55:50 +0000 (08:55 +0000)]
Remove clobber_high
The AArch64 SVE tlsdesc patterns were the main motivating reason
for clobber_high. It's no longer needed now that the patterns use
calls instead.
At the time, one of the possible future uses for clobber_high was for
asm statements. However, the current code wouldn't handle that case
without modification, so I think we might as well remove it for now.
We can always reapply it in future if it turns out to be useful again.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* rtl.def (CLOBBER_HIGH): Delete.
* doc/rtl.texi (clobber_high): Remove documentation.
* rtl.h (SET_DEST): Remove CLOBBER_HIGH from the list of codes.
(reg_is_clobbered_by_clobber_high): Delete.
(gen_hard_reg_clobber_high): Likewise.
* alias.c (record_set): Remove CLOBBER_HIGH handling.
* cfgexpand.c (expand_gimple_stmt): Likewise.
* combine-stack-adj.c (single_set_for_csa): Likewise.
* combine.c (find_single_use_1, set_nonzero_bits_and_sign_copies)
(can_combine_p, is_parallel_of_n_reg_sets, try_combine)
(record_dead_and_set_regs_1, reg_dead_at_p_1): Likewise.
* cse.c (invalidate_reg): Remove clobber_high parameter.
(invalidate): Update call accordingly.
(canonicalize_insn): Remove CLOBBER_HIGH handling.
(invalidate_from_clobbers, invalidate_from_sets_and_clobbers)
(count_reg_usage, insn_live_p): Likewise.
* cselib.h (cselib_invalidate_rtx): Remove sett argument.
* cselib.c (cselib_invalidate_regno, cselib_invalidate_rtx): Likewise.
(cselib_invalidate_rtx_note_stores): Update call accordingly.
(cselib_expand_value_rtx_1): Remove CLOBBER_HIGH handling.
(cselib_invalidate_regno, cselib_process_insn): Likewise.
* dce.c (deletable_insn_p, mark_nonreg_stores_1): Likewise.
(mark_nonreg_stores_2): Likewise.
* df-scan.c (df_find_hard_reg_defs, df_uses_record): Likewise.
(df_get_call_refs): Likewise.
* dwarf2out.c (mem_loc_descriptor): Likewise.
* emit-rtl.c (verify_rtx_sharing): Likewise.
(copy_insn_1, copy_rtx_if_shared_1): Likewise.
(hard_reg_clobbers_high, gen_hard_reg_clobber_high): Delete.
* genconfig.c (walk_insn_part): Remove CLOBBER_HIGH handling.
* genemit.c (gen_exp, gen_insn): Likewise.
* genrecog.c (validate_pattern, remove_clobbers): Likewise.
* haifa-sched.c (haifa_classify_rtx): Likewise.
* ira-build.c (create_insn_allocnos): Likewise.
* ira-costs.c (scan_one_insn): Likewise.
* ira.c (equiv_init_movable_p, memref_referenced_p): Likewise.
(rtx_moveable_p, interesting_dest_for_shprep): Likewise.
* jump.c (mark_jump_label_1): Likewise.
* lra-int.h (lra_insn_reg::clobber_high): Delete.
* lra-eliminations.c (lra_eliminate_regs_1): Remove CLOBBER_HIGH
handling.
(mark_not_eliminable): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
* lra.c (new_insn_reg): Remove clobber_high parameter.
(collect_non_operand_hard_regs): Likewise. Update call to new
insn_reg. Remove CLOBBER_HIGH handling.
(lra_set_insn_recog_data): Remove CLOBBER_HIGH handling. Update call
to collect_non_operand_hard_regs.
(add_regs_to_insn_regno_info): Remove CLOBBER_HIGH handling.
Update call to new_insn_reg.
(lra_update_insn_regno_info): Remove CLOBBER_HIGH handling.
* postreload.c (reload_cse_simplify, reload_combine_note_use)
(move2add_note_store): Likewise.
* print-rtl.c (print_pattern): Likewise.
* recog.c (store_data_bypass_p_1, store_data_bypass_p): Likewise.
(if_test_bypass_p): Likewise.
* regcprop.c (kill_clobbered_value, kill_set_value): Likewise.
* reginfo.c (reg_scan_mark_refs): Likewise.
* reload1.c (maybe_fix_stack_asms, eliminate_regs_1): Likewise.
(elimination_effects, mark_not_eliminable, scan_paradoxical_subregs)
(forget_old_reloads_1): Likewise.
* reorg.c (find_end_label, try_merge_delay_insns, redundant_insn)
(own_thread_p, fill_simple_delay_slots, fill_slots_from_thread)
(dbr_schedule): Likewise.
* resource.c (update_live_status, mark_referenced_resources)
(mark_set_resources): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtlanal.c (reg_referenced_p, set_of_1, single_set_2, noop_move_p)
(note_pattern_stores): Likewise.
(reg_is_clobbered_by_clobber_high): Delete.
* sched-deps.c (sched_analyze_reg, sched_analyze_insn): Remove
CLOBBER_HIGH handling.
From-SVN: r276393
Richard Sandiford [Tue, 1 Oct 2019 08:55:28 +0000 (08:55 +0000)]
[AArch64] Use calls for SVE TLSDESC
One (unintended) side effect of the patches to support multiple
ABIs is that we can now represent tlsdesc calls as normal calls
on SVE targets. This is likely to be handled more efficiently than
clobber_high, and for example fixes the long-standing failure in
gcc.target/aarch64/sve/tls_preserve_1.c.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR target/91452
* config/aarch64/aarch64.h (ARM_PCS_TLSDESC): New arm_pcs.
* config/aarch64/aarch64-protos.h (aarch64_tlsdesc_abi_id): Declare.
* config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
Handle ARM_PCS_TLSDESC.
(aarch64_tlsdesc_abi_id): New function.
* config/aarch64/aarch64.md (tlsdesc_small_sve_<mode>): Use a call
rtx instead of a list of clobbers and clobber_highs.
(tlsdesc_small_<mode>): Update accordingly.
From-SVN: r276392
Richard Sandiford [Tue, 1 Oct 2019 08:53:54 +0000 (08:53 +0000)]
[AArch64] Make call insns record the callee's arm_pcs
At the moment we rely on SYMBOL_REF_DECL to get the ABI of the callee
of a call insn, falling back to the default ABI if the decl isn't
available. I think it'd be cleaner to attach the ABI directly to the
call instruction instead, which would also have the very minor benefit
of handling indirect calls more efficiently.
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64-protos.h (aarch64_expand_call): Take an
extra callee_abi argument.
* config/aarch64/aarch64.c (aarch64_expand_call): Likewise.
Insert a CALLEE_ABI unspec into the call pattern as the second
element in the PARALLEL.
(aarch64_simd_call_p): Delete.
(aarch64_insn_callee_abi): Get the arm_pcs of the callee from
the new CALLEE_ABI element of the PARALLEL.
(aarch64_init_cumulative_args): Get the arm_pcs of the callee
from the function type, if given.
(aarch64_function_arg_advance): Handle ARM_PCS_SIMD.
(aarch64_function_arg): Likewise. Return the arm_pcs of the callee
when passed the function_arg_info end marker.
(aarch64_output_mi_thunk): Pass the arm_pcs of the callee as the
final argument of gen_sibcall.
* config/aarch64/aarch64.md (UNSPEC_CALLEE_ABI): New unspec.
(call): Make operand 2 a const_int_operand and pass it to expand_call.
Wrap it in an UNSPEC_CALLEE_ABI unspec for the dummy define_expand
pattern.
(call_value): Likewise operand 3.
(sibcall): Likewise operand 2. Place the unspec before rather than
after the return.
(sibcall_value): Likewise operand 3.
(*call_insn, *call_value_insn): Include an UNSPEC_CALLEE_ABI.
(tlsgd_small_<mode>, *tlsgd_small_<mode>): Likewise.
(*sibcall_insn, *sibcall_value_insn): Likewise. Remove empty
constraint strings.
(untyped_call): Pass const0_rtx as the callee ABI to gen_call.
gcc/testsuite/
* gcc.target/aarch64/torture/simd-abi-10.c: New test.
* gcc.target/aarch64/torture/simd-abi-11.c: Likewise.
From-SVN: r276391
Jakub Jelinek [Tue, 1 Oct 2019 07:51:46 +0000 (09:51 +0200)]
configure.ac: Remove GCC_HEADER_STDINT(gstdint.h).
* configure.ac: Remove GCC_HEADER_STDINT(gstdint.h).
* libgomp.h: Include <stdint.h> instead of "gstdint.h".
* oacc-parallel.c: Don't include "libgomp_g.h".
* plugin/plugin-hsa.c: Include <stdint.h> instead of "gstdint.h".
* plugin/plugin-nvptx.c: Don't include "gstdint.h".
* aclocal.m4: Regenerated.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
From-SVN: r276389
Richard Sandiford [Tue, 1 Oct 2019 07:46:45 +0000 (07:46 +0000)]
Update remaining calls to choose_hard_reg_mode
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* regs.h (HARD_REGNO_CALLER_SAVE_MODE): Update call to
choose_hard_reg_mode.
* config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise.
From-SVN: r276388
Segher Boessenkool [Tue, 1 Oct 2019 06:50:31 +0000 (08:50 +0200)]
doc/md.texi: Fix some typos
It says "size N/2" in a few places where "size S/2" is meant.
* doc/md.texi (vec_pack_trunc_@var{m}): Fix typo.
(vec_pack_sfix_trunc_@var{m}, vec_pack_ufix_trunc_@var{m}): Ditto.
(vec_packs_float_@var{m}, vec_packu_float_@var{m}): Ditto.
From-SVN: r276387
GCC Administrator [Tue, 1 Oct 2019 00:16:16 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r276386
Ian Lance Taylor [Mon, 30 Sep 2019 22:27:44 +0000 (22:27 +0000)]
compiler: change escape maps to hash tables
Also use just one table lookup, not two.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197759
From-SVN: r276382
Joseph Myers [Mon, 30 Sep 2019 21:53:42 +0000 (22:53 +0100)]
* es.po: Update.
From-SVN: r276380
François Dumont [Mon, 30 Sep 2019 20:38:15 +0000 (20:38 +0000)]
Implement C++20 constexpr comparison operators for __debug::array (P1023).
Add missing ChangeLog entry.
From-SVN: r276376
François Dumont [Mon, 30 Sep 2019 20:33:51 +0000 (20:33 +0000)]
Implement C++20 constexpr comparison operators for __debug::array (P1023).
* include/debug/array: Add C++20 constexpr to comparison operators.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adapt
dg-error line numbers.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.
From-SVN: r276375
Andreas Tobler [Mon, 30 Sep 2019 20:26:57 +0000 (22:26 +0200)]
Include netinet/in.h in include/experimental/internet
2019-09-30 Andreas Tobler <andreast@gcc.gnu.org>
* include/experimental/internet: Include netinet/in.h if we have
_GLIBCXX_HAVE_NETINET_IN_H defined.
From-SVN: r276374
Andreas Tobler [Mon, 30 Sep 2019 20:25:37 +0000 (22:25 +0200)]
libstdc++ testsuite, silence a FreeBSD libm warning
Add missing ChangeLog entry for the previous commit.
From-SVN: r276373
Andreas Tobler [Mon, 30 Sep 2019 20:23:02 +0000 (22:23 +0200)]
libstdc++ testsuite, silence a FreeBSD libm warning
2019-09-30 Andreas Tobler <andreast@gcc.gnu.org>
* testsuite/ext/special_functions/airy_ai/check_nan.cc: Ignore the
FreeBSD warning about lower advertised precision of tgammal.
* testsuite/ext/special_functions/airy_bi/check_nan.cc: Likewise.
* testsuite/special_functions/07_cyl_bessel_i/check_nan.cc: Likewise.
* testsuite/special_functions/08_cyl_bessel_j/check_nan.cc: Likewise.
* testsuite/special_functions/09_cyl_bessel_k/check_nan.cc: Likewise.
* testsuite/special_functions/10_cyl_neumann/check_nan.cc: Likewise.
* testsuite/special_functions/19_sph_bessel/check_nan.cc: Likewise.
* testsuite/special_functions/21_sph_neumann/check_nan.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
08_cyl_bessel_i/check_nan.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
09_cyl_bessel_j/check_nan.cc: Likewise.
* testuite/tr1/5_numerical_facilities/special_functions/
10_cyl_bessel_k/check_nan.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
11_cyl_neumann/check_nan.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
21_sph_bessel/check_nan.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/special_functions/
23_sph_neumann/check_nan.cc: Likewise.
From-SVN: r276372
David Malcolm [Mon, 30 Sep 2019 20:03:55 +0000 (20:03 +0000)]
diagnostic-show-locus.c: rework handling of multiple labels
This patch improves the handling of large numbers of labels within a
rich_location: previously, overlapping labels could lead to an assertion
failure within layout::print_any_labels. Also, the labels were printed
in reverse order of insertion into the rich_location.
This patch moves the determination of whether a vertical bar should
be printed for a line_label into the
'Figure out how many "label lines" we need, and which
one each label is printed in.'
step of layout::print_any_labels, rather than doing it as the lines
are printed. It also flips the sort order, so that labels at the
same line/column are printed in order of insertion into the
rich_location.
I haven't run into these issues with our existing diagnostics, but it
affects a patch kit I'm working on that makes more extensive use of
labels.
gcc/ChangeLog:
* diagnostic-show-locus.c (line_label::line_label): Initialize
m_has_vbar.
(line_label::comparator): Reverse the sort order by m_state_idx,
so that when the list is walked backwards the labels appear in
order of insertion into the rich_location.
(line_label::m_has_vbar): New field.
(layout::print_any_labels): When dealing with multiple labels at
the same line and column, only print vertical bars for the one
with the highest label_line.
(selftest::test_one_liner_labels): Update test for multiple labels
to expect the labels to be in the order of insertion into the
rich_location. Add a test for many such labels, where the column
numbers are out-of-order relative to the insertion order.
From-SVN: r276371
Richard Sandiford [Mon, 30 Sep 2019 18:36:11 +0000 (18:36 +0000)]
[x86] Cache result of expensive_function_p between frame layouts
ix86_compute_frame_layout sets use_fast_prologue_epilogue if
the function isn't more expensive than a certain threshold,
where the threshold depends on the number of saved registers.
However, the RA is allowed to insert and delete instructions
as it goes along, which can change whether this threshold is
crossed or not.
I hit this with an RA change I'm working on. Rematerialisation
was able to remove an instruction and avoid a spill, which happened
to bring the size of the function below the threshold. But since
nothing legitimately frame-related had changed, there was no need for
the RA to lay out the frame again. We then failed the final sanity
check in lra_eliminate.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/i386/i386.h (ix86_frame::expensive_p): New field.
(ix86_frame::expensive_count): Likewise.
* config/i386/i386.c (ix86_compute_frame_layout): Make the choice
of use_fast_prologue_epilogue robust against incidental changes
in function size.
From-SVN: r276361
Ilya Leoshkevich [Mon, 30 Sep 2019 17:40:02 +0000 (17:40 +0000)]
S/390: Remove code duplication in vec_unordered<mode>
vec_unordered<mode> is vec_ordered<mode> plus a negation at the end.
Reuse vec_unordered<mode> logic.
gcc/ChangeLog:
2019-09-30 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/77918
* config/s390/vector.md (vec_unordered<mode>): Call
gen_vec_ordered<mode>.
From-SVN: r276360
Michael Meissner [Mon, 30 Sep 2019 17:22:14 +0000 (17:22 +0000)]
Fix typo in my last commit's ChangeLog entry
From-SVN: r276359
Yuliang Wang [Mon, 30 Sep 2019 16:55:45 +0000 (16:55 +0000)]
[AArch64][SVE] Utilize ASRD instruction for division and remainder
2019-09-30 Yuliang Wang <yuliang.wang@arm.com>
gcc/
* config/aarch64/aarch64-sve.md (sdiv_pow2<mode>3):
New pattern for ASRD.
* config/aarch64/iterators.md (UNSPEC_ASRD): New unspec.
* internal-fn.def (IFN_DIV_POW2): New internal function.
* optabs.def (sdiv_pow2_optab): New optab.
* tree-vect-patterns.c (vect_recog_divmod_pattern):
Modify pattern to support new operation.
* doc/md.texi (sdiv_pow2$var{m3}): Documentation for the above.
* doc/sourcebuild.texi (vect_sdiv_pow2_si):
Document new target selector.
gcc/testsuite/
* gcc.dg/vect/vect-sdiv-pow2-1.c: New test.
* gcc.target/aarch64/sve/asrdiv_1.c: As above.
* lib/target-supports.exp (check_effective_target_vect_sdiv_pow2_si):
Return true for AArch64 with SVE.
From-SVN: r276343
Richard Sandiford [Mon, 30 Sep 2019 16:47:39 +0000 (16:47 +0000)]
[AArch64] Make more use of function_abi
This patch makes more use of the function_abi infrastructure.
We can then avoid checking specifically for the vector PCS in
a few places, and can test it more directly otherwise.
Specifically: we no longer need to call df_set_regs_ever_live
for the extra call-saved registers, since IRA now does that for us.
We also don't need to handle the vector PCS specially in
aarch64_epilogue_uses, because DF now marks the registers
as live on exit.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64.c (aarch64_layout_frame): Use crtl->abi
to test whether we're compiling a vector PCS function and to test
whether the function needs to save a particular register.
Remove the vector PCS handling of df_set_regs_ever_live.
(aarch64_components_for_bb): Use crtl->abi to test whether
the function needs to save a particular register.
(aarch64_process_components): Use crtl->abi to test whether
we're compiling a vector PCS function.
(aarch64_expand_prologue, aarch64_expand_epilogue): Likewise.
(aarch64_epilogue_uses): Remove handling of vector PCS functions.
From-SVN: r276341
Richard Sandiford [Mon, 30 Sep 2019 16:47:21 +0000 (16:47 +0000)]
[AArch64] Allow shrink-wrapping of non-leaf vector PCS functions
With the function ABI stuff, we can now support shrink-wrapping of
non-leaf vector PCS functions. This is particularly useful if the
vector PCS function calls an ordinary function on an error path,
since we can then keep the extra saves and restores specific to
that path too.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64-protos.h (aarch64_use_simple_return_insn_p):
Delete.
* config/aarch64/aarch64.c (aarch64_components_for_bb): Check
whether the block calls a function that clobbers more registers
than the current function is allowed to.
(aarch64_use_simple_return_insn_p): Delete.
* config/aarch64/aarch64.md (simple_return): Remove condition.
gcc/testsuite/
* gcc.target/aarch64/torture/simd-abi-9.c: New test.
From-SVN: r276340
Richard Sandiford [Mon, 30 Sep 2019 16:39:38 +0000 (16:39 +0000)]
Make ira call df_set_regs_ever_live for extra call-clobbered regs
If we support multiple ABIs in the same translation unit, it can
sometimes be the case that a callee clobbers more registers than
its caller is allowed to. We need to call df_set_regs_ever_live
on these extra registers so that the prologue and epilogue code
can handle them appropriately.
This patch does that in IRA. I wanted to avoid another full
instruction walk just for this, so I combined it with the existing
set_paradoxical_subreg walk. This happens before the first
calculation of elimination offsets.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* function-abi.h (function_abi_aggregator): New class.
* function-abi.cc (function_abi_aggregator::caller_save_regs): New
function.
* ira.c (update_equiv_regs_prescan): New function. Call
set_paradoxical_subreg here rather than...
(update_equiv_regs): ...here.
(ira): Call update_equiv_regs_prescan.
From-SVN: r276339
Richard Sandiford [Mon, 30 Sep 2019 16:21:49 +0000 (16:21 +0000)]
Hide regs_invalidated_by_call etc.
The previous patches removed all target-independent uses of
regs_invalidated_by_call, call_used_or_fixed_regs and
call_used_or_fixed_reg_p. This patch therefore restricts
them to target-specific code (and reginfo.c, which sets them up).
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* hard-reg-set.h (regs_invalidated_by_call): Only define if
IN_TARGET_CODE.
(call_used_or_fixed_regs): Likewise.
(call_used_or_fixed_reg_p): Likewise.
* reginfo.c (regs_invalidated_by_call): New macro.
From-SVN: r276338
Richard Sandiford [Mon, 30 Sep 2019 16:21:44 +0000 (16:21 +0000)]
Remove global call sets: shrink-wrap.c
This is a straight replacement of "calls we can clobber without saving
them first".
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* shrink-wrap.c: Include function-abi.h.
(requires_stack_frame_p): Use crtl->abi to test whether the
current function can use a register without saving it first.
From-SVN: r276337
Richard Sandiford [Mon, 30 Sep 2019 16:21:39 +0000 (16:21 +0000)]
Remove global call sets: sel-sched.c
The main change here is to replace a crosses_call boolean with
a bitmask of the ABIs used by the crossed calls. For space reasons,
I didn't also add a HARD_REG_SET that tracks the set of registers
that are actually clobbered, which means that this is the one part
of the series that doesn't benefit from -fipa-ra. The existing
FIXME suggests that the current structures aren't the preferred
way of representing this anyhow, and the pass already makes
conservative assumptions about call-crossing registers.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* sel-sched-ir.h (_def::crosses_call): Replace with...
(_def::crossed_call_abis): ..this new field.
(def_list_add): Take a mask of ABIs instead of a crosses_call
boolean.
* sel-sched-ir.c (def_list_add): Likewise. Update initialization
of _def accordingly.
* sel-sched.c: Include function-abi.h.
(hard_regs_data::regs_for_call_clobbered): Delete.
(reg_rename::crosses_call): Replace with...
(reg_rename::crossed_call_abis): ...this new field.
(fur_static_params::crosses_call): Replace with...
(fur_static_params::crossed_call_abis): ...this new field.
(init_regs_for_mode): Don't initialize sel_hrd.regs_for_call_clobbered.
(init_hard_regs_data): Use crtl->abi to test which registers the
current function would need to save before it uses them.
(mark_unavailable_hard_regs): Update handling of call-clobbered
registers, using call_clobbers_in_region to find out which registers
might be call-clobbered (but without taking -fipa-ra into account
for now). Remove separate handling of partially call-clobbered
registers.
(verify_target_availability): Use crossed_call_abis instead of
crosses_call.
(get_spec_check_type_for_insn, find_used_regs): Likewise.
(fur_orig_expr_found, fur_on_enter, fur_orig_expr_not_found): Likewise.
From-SVN: r276336
Richard Sandiford [Mon, 30 Sep 2019 16:21:34 +0000 (16:21 +0000)]
Remove global call sets: sched-deps.c
This is a straight replacement of an existing "full or partial"
call-clobber check.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* sched-deps.c (deps_analyze_insn): Use the ABI of the target
function to test whether a register is fully or partly clobbered.
From-SVN: r276335
Richard Sandiford [Mon, 30 Sep 2019 16:21:28 +0000 (16:21 +0000)]
Remove global call sets: rtlanal.c
The reg_set_p part is simple, since the caller is asking about
a specific REG rtx, with a known register number and mode.
The find_all_hard_reg_sets part emphasises that the "implicit"
behaviour was always a bit suspect, since it includes fully-clobbered
registers but not partially-clobbered registers. The only current
user of this path is the c6x-specific scheduler predication code,
and c6x doesn't have partly call-clobbered registers, so in practice
it's fine. I've added a comment to try to disuade future users.
(The !implicit path is OK and useful though.)
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* rtlanal.c: Include function-abi.h.
(reg_set_p): Use insn_callee_abi to get the ABI of the called
function and clobbers_reg_p to test whether the register
is call-clobbered.
(find_all_hard_reg_sets): When implicit is true, use insn_callee_abi
to get the ABI of the called function and full_reg_clobbers to
get the set of fully call-clobbered registers. Warn about the
pitfalls of using this mode.
From-SVN: r276334
Richard Sandiford [Mon, 30 Sep 2019 16:21:23 +0000 (16:21 +0000)]
Remove global call sets: reload.c
The inheritance code in find_equiv_reg can use clobbers_reg_p
to test whether a call clobbers either of the equivalent registers.
reload and find_reg use crtl->abi to test whether a register needs
to be saved in the prologue before use.
reload_as_needed can use full_and_partial_reg_clobbers and thus
avoid needing to keep its own record of which registers are part
call-clobbered.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* reload.c: Include function-abi.h.
(find_equiv_reg): Use clobbers_reg_p to test whether either
of the equivalent registers is clobbered by a call.
* reload1.c: Include function-abi.h.
(reg_reloaded_call_part_clobbered): Delete.
(reload): Use crtl->abi to test which registers would need
saving in the prologue before use.
(find_reg): Likewise.
(emit_reload_insns): Remove code for reg_reloaded_call_part_clobbered.
(reload_as_needed): Likewise. Use full_and_partial_reg_clobbers
instead of call_used_or_fixed_regs | reg_reloaded_call_part_clobbered.
From-SVN: r276333
Richard Sandiford [Mon, 30 Sep 2019 16:21:19 +0000 (16:21 +0000)]
Remove global call sets: regrename.c
This patch makes regrename use a similar mask-and-clobber-set
pair to IRA when tracking whether registers are clobbered by
calls in a region. Testing for a nonzero ABI mask is equivalent
to testing for a register that crosses a call.
Since AArch64 and c6x use regrename.h, they need to be updated
to include function-abi.h first. AIUI this is preferred over
including function-abi.h in regrename.h.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* regrename.h (du_head::call_clobber_mask): New field.
(du_head::need_caller_save_reg): Replace with...
(du_head::call_abis): ...this new field.
* regrename.c: Include function-abi.h.
(call_clobbered_in_chain_p): New function.
(check_new_reg_p): Use crtl->abi when deciding whether a register
is free for use after RA. Use call_clobbered_in_chain_p to test
whether a candidate register would be clobbered by a call.
(find_rename_reg): Don't add call-clobber conflicts here.
(rename_chains): Check call_abis instead of need_caller_save_reg.
(merge_chains): Update for changes to du_head.
(build_def_use): Use insn_callee_abi to get the ABI of the call insn
target. Record the ABI identifier in call_abis and the set of
fully or partially clobbered registers in call_clobber_mask.
Add fully-clobbered registers to hard_conflicts here rather
than in find_rename_reg.
* config/aarch64/cortex-a57-fma-steering.c: Include function-abi.h.
(rename_single_chain): Check call_abis instead of need_caller_save_reg.
* config/aarch64/falkor-tag-collision-avoidance.c: Include
function-abi.h.
* config/c6x/c6x.c: Likewise.
From-SVN: r276332
Richard Sandiford [Mon, 30 Sep 2019 16:21:14 +0000 (16:21 +0000)]
Remove global call sets: regcprop.c
This is a direct replacement of an existing test for fully and
partially clobbered registers.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* regcprop.c (copyprop_hardreg_forward_1): Use the recorded
mode of the register when deciding whether it is no longer
available after a call.
From-SVN: r276331
Richard Sandiford [Mon, 30 Sep 2019 16:21:10 +0000 (16:21 +0000)]
Remove global call sets: recog.c
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* recog.c: Include function-abi.h.
(peep2_find_free_register): Use crtl->abi when deciding whether
a register is free for use after RA.
From-SVN: r276330
Richard Sandiford [Mon, 30 Sep 2019 16:21:07 +0000 (16:21 +0000)]
Remove global call sets: postreload-gcse.c
This is another case in which we should conservatively treat
partial kills as full kills.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* postreload-gcse.c: Include regs.h and function-abi.h.
(record_opr_changes): Use insn_callee_abi to get the ABI of the
call insn target. Conservatively assume that partially-clobbered
registers are altered.
From-SVN: r276329
Richard Sandiford [Mon, 30 Sep 2019 16:21:03 +0000 (16:21 +0000)]
Remove global call sets: postreload.c
The "|= fixed_regs" in reload_combine isn't necessary, since the
set is only used to determine which values have changed (rather than,
for example, which registers are available for use).
In reload_cse_move2add we can be accurate about which registers
are still available. BLKmode indicates a continuation of the
previous register, and since clobbers_reg_p handles multi-register
values, it's enough to skip over BLKmode entries and just test the
start register.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* postreload.c (reload_combine_recognize_pattern): Use crtl->abi
when deciding whether a register is free for use after RA.
(reload_combine): Remove unnecessary use of fixed_reg_set.
(reload_cse_move2add): Use insn_callee_abi to get the ABI of the
call insn target. Use reg_mode when testing whether a register
is no longer available.
From-SVN: r276328
Richard Sandiford [Mon, 30 Sep 2019 16:21:00 +0000 (16:21 +0000)]
Remove global call sets: LRA
lra_reg has an actual_call_used_reg_set field that is only used during
inheritance. This in turn required a special lra_create_live_ranges
pass for flag_ipa_ra to set up this field. This patch instead makes
the inheritance code do its own live register tracking, using the
same ABI-mask-and-clobber-set pair as for IRA.
Tracking ABIs simplifies (and cheapens) the logic in lra-lives.c and
means we no longer need a separate path for -fipa-ra. It also means
we can remove TARGET_RETURN_CALL_WITH_MAX_CLOBBERS.
The patch also strengthens the sanity check in lra_assigns so that
we check that reg_renumber is consistent with the whole conflict set,
not just the call-clobbered registers.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.def (return_call_with_max_clobbers): Delete.
* doc/tm.texi.in (TARGET_RETURN_CALL_WITH_MAX_CLOBBERS): Delete.
* doc/tm.texi: Regenerate.
* config/aarch64/aarch64.c (aarch64_return_call_with_max_clobbers)
(TARGET_RETURN_CALL_WITH_MAX_CLOBBERS): Delete.
* lra-int.h (lra_reg::actual_call_used_reg_set): Delete.
(lra_reg::call_insn): Delete.
* lra.c: Include function-abi.h.
(initialize_lra_reg_info_element): Don't initialize the fields above.
(lra): Use crtl->abi to test whether the current function needs to
save a register in the prologue. Remove special pre-inheritance
lra_create_live_ranges pass for flag_ipa_ra.
* lra-assigns.c: Include function-abi.h
(find_hard_regno_for_1): Use crtl->abi to test whether the current
function needs to save a register in the prologue.
(lra_assign): Assert that registers aren't allocated to a
conflicting register, rather than checking only for overlaps
with call_used_or_fixed_regs. Do this even for flag_ipa_ra,
and for registers that are not live across a call.
* lra-constraints.c (last_call_for_abi): New variable.
(full_and_partial_call_clobbers): Likewise.
(setup_next_usage_insn): Remove the register from
full_and_partial_call_clobbers.
(need_for_call_save_p): Use call_clobbered_in_region_p to test
whether the register needs a caller save.
(need_for_split_p): Use full_and_partial_reg_clobbers instead
of call_used_or_fixed_regs.
(inherit_in_ebb): Initialize and maintain last_call_for_abi and
full_and_partial_call_clobbers.
* lra-lives.c (check_pseudos_live_through_calls): Replace
last_call_used_reg_set and call_insn arguments with an abi argument.
Remove handling of lra_reg::call_insn. Use function_abi::mode_clobbers
as the set of conflicting registers.
(calls_have_same_clobbers_p): Delete.
(process_bb_lives): Track the ABI of the last call instead of an
insn/HARD_REG_SET pair. Update calls to
check_pseudos_live_through_calls. Use eh_edge_abi to calculate
the set of registers that could be clobbered by an EH edge.
Include partially-clobbered as well as fully-clobbered registers.
(lra_create_live_ranges_1): Don't initialize lra_reg::call_insn.
* lra-remat.c: Include function-abi.h.
(call_used_regs_arr_len, call_used_regs_arr): Delete.
(set_bb_regs): Use insn_callee_abi to get the set of call-clobbered
registers and bitmap_view to combine them into dead_regs.
(call_used_input_regno_present_p): Take a function_abi argument
and use it to test whether a register is call-clobbered.
(calculate_gen_cands): Use insn_callee_abi to get the ABI of the
call insn target. Update tje call to call_used_input_regno_present_p.
(do_remat): Likewise.
(lra_remat): Remove the initialization of call_used_regs_arr_len
and call_used_regs_arr.
From-SVN: r276327
Richard Sandiford [Mon, 30 Sep 2019 16:20:56 +0000 (16:20 +0000)]
Remove global call sets: loop-iv.c
Similar idea to the combine.c and gcse.c patches.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* loop-iv.c: Include regs.h and function-abi.h.
(simplify_using_initial_values): Use insn_callee_abi to get the
ABI of the call insn target. Conservatively assume that
partially-clobbered registers are altered.
From-SVN: r276326
Richard Sandiford [Mon, 30 Sep 2019 16:20:52 +0000 (16:20 +0000)]
Remove global call sets: IRA
For -fipa-ra, IRA already keeps track of which specific registers
are call-clobbered in a region, rather than using global information.
The patch generalises this so that it tracks which ABIs are used
by calls in the region.
We can then use the new ABI descriptors to handle partially-clobbered
registers in the same way as fully-clobbered registers, without having
special code for targetm.hard_regno_call_part_clobbered. This in turn
makes -fipa-ra work for partially-clobbered registers too.
A side-effect of allowing multiple ABIs is that we no longer have
an obvious set of conflicting registers for the self-described
"fragile hack" in ira-constraints.c. This code kicks in for
user-defined registers that aren't live across a call at -O0,
and it tries to avoid allocating a call-clobbered register to them.
Here I've used the set of call-clobbered registers in the current
function's ABI, applying on top of any registers that are clobbered by
called functions. This is enough to keep gcc.dg/debug/dwarf2/pr5948.c
happy.
The handling of GENERIC_STACK_CHECK in do_reload seemed to have
a reversed condition:
for (int i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (df_regs_ever_live_p (i)
&& !fixed_regs[i]
&& call_used_or_fixed_reg_p (i))
size += UNITS_PER_WORD;
The final part of the condition counts registers that don't need to be
saved in the prologue, but I think the opposite was intended.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* function-abi.h (call_clobbers_in_region): Declare.
(call_clobbered_in_region_p): New function.
* function-abi.cc (call_clobbers_in_region): Likewise.
* ira-int.h: Include function-abi.h.
(ira_allocno::crossed_calls_abis): New field.
(ALLOCNO_CROSSED_CALLS_ABIS): New macro.
(ira_need_caller_save_regs): New function.
(ira_need_caller_save_p): Likewise.
* ira.c (setup_reg_renumber): Use ira_need_caller_save_p instead
of call_used_or_fixed_regs.
(do_reload): Use crtl->abi to test whether the current function
needs to save a register in the prologue. Count registers that
need to be saved rather than registers that don't.
* ira-build.c (create_cap_allocno): Copy ALLOCNO_CROSSED_CALLS_ABIS.
Remove unnecessary | from ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS.
(propagate_allocno_info): Merge ALLOCNO_CROSSED_CALLS_ABIS too.
(propagate_some_info_from_allocno): Likewise.
(copy_info_to_removed_store_destinations): Likewise.
(ira_flattening): Say that ALLOCNO_CROSSED_CALLS_ABIS and
ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS are handled conservatively.
(ira_build): Use ira_need_caller_save_regs instead of
call_used_or_fixed_regs.
* ira-color.c (calculate_saved_nregs): Use crtl->abi to test
whether the current function would need to save a register
before using it.
(calculate_spill_cost): Likewise.
(allocno_reload_assign): Use ira_need_caller_save_regs and
ira_need_caller_save_p instead of call_used_or_fixed_regs.
* ira-conflicts.c (ira_build_conflicts): Use
ira_need_caller_save_regs rather than call_used_or_fixed_regs
as the set of call-clobbered registers. Remove the
call_used_or_fixed_regs mask from the calculation of
temp_hard_reg_set and mask its use instead. Remove special
handling of partially-clobbered registers.
* ira-costs.c (ira_tune_allocno_costs): Use ira_need_caller_save_p.
* ira-lives.c (process_bb_node_lives): Use mode_clobbers to
calculate the set of conflicting registers for calls that
can throw. Record the ABIs of calls in ALLOCNO_CROSSED_CALLS_ABIS.
Use full_and_partial_reg_clobbers rather than full_reg_clobbers
for the calculation of ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS.
Use eh_edge_abi to calculate the set of registers that could
be clobbered by an EH edge. Include partially-clobbered as
well as fully-clobbered registers.
From-SVN: r276325
Richard Sandiford [Mon, 30 Sep 2019 16:20:48 +0000 (16:20 +0000)]
Remove global call sets: haifa-sched.c
The code patched here is counting how many registers the current
function would need to save in the prologue before it uses them.
The code is called per function, so using crtl is OK.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* haifa-sched.c: Include function-abi.h.
(alloc_global_sched_pressure_data): Use crtl->abi to check whether
the function would need to save a register before using it.
From-SVN: r276324
Richard Sandiford [Mon, 30 Sep 2019 16:20:44 +0000 (16:20 +0000)]
Remove global call sets: gcse.c
This is another case in which we can conservatively treat partial
kills as full kills. Again this is in principle a bug fix for
TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets, but in practice
it probably doesn't make a difference.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* gcse.c: Include function-abi.h.
(compute_hash_table_work): Use insn_callee_abi to get the ABI of
the call insn target. Invalidate partially call-clobbered
registers as well as fully call-clobbered ones.
From-SVN: r276323
Richard Sandiford [Mon, 30 Sep 2019 16:20:41 +0000 (16:20 +0000)]
Remove global call sets: function.c
Whatever the rights and wrongs of the way aggregate_value_p
handles call-preserved registers, it's a de facto part of the ABI,
so we shouldn't change it. The patch simply extends the current
approach to whatever call-preserved set the function happens to
be using.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* function.c (aggregate_value_p): Work out which ABI the
function is using before testing which registers are at least
partly preserved by a call.
From-SVN: r276322