Commit graph

179392 commits

Author SHA1 Message Date
Bill Schmidt
8c0f8755b2 rs6000: Add rs6000_cfun_pcrel_p
Most uses of rs6000_pcrel_p are called for the current function.
A specialized version for cfun is more efficient for these uses.

2020-09-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/predicates.md (current_file_function_operand):
	Remove argument from rs6000_pcrel_p call.
	* config/rs6000/rs6000-logue.c (rs6000_decl_ok_for_sibcall):
	Likewise.
	(rs6000_global_entry_point_prologue_needed_p): Likewise.
	(rs6000_output_function_prologue): Likewise.
	* config/rs6000/rs6000-protos.h (rs6000_function_pcrel_p): New
	prototype.
	(rs6000_pcrel_p): Remove argument.
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Remove
	argument from rs6000_pcrel_p call.
	(rs6000_call_template_1): Likewise.
	(rs6000_indirect_call_template_1): Likewise.
	(rs6000_longcall_ref): Likewise.
	(rs6000_call_aix): Likewise.
	(rs6000_sibcall_aix): Likewise.
	(rs6000_function_pcrel_p): Rename from rs6000_pcrel_p.
	(rs6000_pcrel_p): Rewrite.
	* config/rs6000/rs6000.md (*pltseq_plt_pcrel<mode>): Remove
	argument from rs6000_pcrel_p call.
	(*call_local<mode>): Likewise.
	(*call_value_local<mode>): Likewise.
	(*call_nonlocal_aix<mode>): Likewise.
	(*call_value_nonlocal_aix<mode>): Likewise.
	(*call_indirect_pcrel<mode>): Likewise.
	(*call_value_indirect_pcrel<mode>): Likewise.
2020-09-16 16:12:35 -05:00
Martin Sebor
71ad0b5dde Detect conflicts between incompatible uses of the same attribute (PR c/78666).
Resolves:
PR c/78666 - conflicting attribute alloc_size accepted
PR c/96126 - conflicting attribute section accepted on redeclaration

gcc/c-family/ChangeLog:

	PR c/78666
	PR c/96126
	* c-attribs.c (validate_attr_args): New function.
	(validate_attr_arg): Same.
	(handle_section_attribute): Call it.  Introduce a local variable.
	(handle_alloc_size_attribute):  Same.
	(handle_alloc_align_attribute): Same.

gcc/testsuite/ChangeLog:

	PR c/78666
	PR c/96126
	* gcc.dg/attr-alloc_align-5.c: New test.
	* gcc.dg/attr-alloc_size-13.c: New test.
	* gcc.dg/attr-section.c: New test.
	* c-c++-common/builtin-has-attribute-3.c: Add xfails due to expected
	warnings to be cleaned up.
2020-09-16 14:04:01 -06:00
Marek Polacek
31dd5cd634 preprocessor: Fix ICE with too long line in fmtwarn [PR96935]
Here we ICE in char_span::subspan because the offset it gets is -1.
It's -1 because get_substring_ranges_for_loc gets a location whose
column was 0.  That only happens in testcases like the attached where
we're dealing with extremely long lines (at least 4065 chars it seems).
This does happen in practice, though, so it's not just a theoretical
problem (e.g. when building the SU2 suite).

Fixed by checking that the column get_substring_ranges_for_loc gets is
sane, akin to other checks in that function.

gcc/ChangeLog:

	PR preprocessor/96935
	* input.c (get_substring_ranges_for_loc): Return if start.column
	is less than 1.

gcc/testsuite/ChangeLog:

	PR preprocessor/96935
	* gcc.dg/format/pr96935.c: New test.
2020-09-16 15:29:49 -04:00
Martin Sebor
8b75204b27 Work harder to avoid -Wuninitialized for objects of empty structs (PR middle-end/96295).
Resolves:
PR middle-end/96295 - -Wmaybe-uninitialized warning for range operator with
reference to an empty struct

gcc/ChangeLog:

	PR middle-end/96295
	* tree-ssa-uninit.c (maybe_warn_operand): Work harder to avoid
	warning for objects of empty structs

gcc/testsuite/ChangeLog:

	PR middle-end/96295
	* g++.dg/warn/Wuninitialized-11.C: New test.
2020-09-16 13:23:31 -06:00
Nathan Sidwell
8155316c6f c++: local-scope OMP UDR reductions have no template head
This corrects the earlier problems with removing the template header
from local omp reductions.  And it uncovered a latent bug.  When we
tsubst such a decl, we immediately tsubst its body.
cp_check_omp_declare_reduction gets a success return value to gate
that instantiation.

udr-2.C got a further error, as the omp checking machinery doesn't
appear to turn the reduction into an error mark when failing.  I
didn't dig into that further.  udr-3.C appears to have been invalid
and accidentally worked.

	gcc/cp/
	* cp-tree.h (cp_check_omp_declare_reduction): Return bool.
	* semantics.c (cp_check_omp_declare_reduction): Return true on for
	success.
	* pt.c (push_template_decl_real): OMP reductions do not get a
	template header.
	(tsubst_function_decl): Remove special casing for local decl omp
	reductions.
	(tsubst_expr): Call instantiate_body for a local omp reduction.
	(instantiate_body): Add nested_p parm, and deal with such
	instantiations.
	(instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
	instantiate_body call.
	gcc/testsuite/
	* g++.dg/gomp/udr-2.C: Add additional expected error.
	libgomp/
	* testsuite/libgomp.c++/udr-3.C: Add missing ctor.
2020-09-16 12:16:11 -07:00
Iain Sandoe
d1339b519a libbacktrace, Mach-O : Support PowerPC archs.
This adds the PPC architecture variants for Mach-O libbacktrace.

With this (as for X86 and Arm) when dsymutil is run on the binary
we get a basic usable backtrace.

Testsuite results on powerpc-apple-darwin9 are the same as for X86:
 * btest fails (TBC why)
 * dwarf5 tests fail because dsymutil does not handle that so far.

libbacktrace/ChangeLog:

	* macho.c (MACH_O_CPU_TYPE_PPC): New.
	(MACH_O_CPU_TYPE_PPC64): New.
	Add compile-tests for powerpc to the Mach-O variants.
2020-09-16 19:37:28 +01:00
Eric Botcazou
aab6194d08 Fix pessimization in EH cleanup pass
This restores the post-order traversal done by cleanup_all_empty_eh in
order to eliminate empty landing pads and also contains a small tweak
to the line debug info to avoid a problematic inheritance for coverage
measurement.

gcc/ChangeLog:
	* tree-eh.c (lower_try_finally_dup_block): Backward propagate slocs
	to stack restore builtin calls.
	(cleanup_all_empty_eh): Do again a post-order traversal of the EH
	region tree.

gcc/testsuite/ChangeLog:
	* gnat.dg/concat4.adb: New test.
2020-09-16 17:42:51 +02:00
Nathan Sidwell
7d1be939e0 c++: Avoid confusing 'nested' name
instantiate_body has a local var call 'nested', which indicates that
this instantiation was caused during the body of some function -- not
necessarily its containing scope.  That's confusing, let's just use
'current_function_decl' directly.  Then we can also simplify the
push_to_top_level logic, which /does/ indicate whether this is an
actual nested function.  (C++ does not have nested functions, but OMP
ODRs fall into that category.  A follow up patch will use that more
usual meaning of 'nested' wrt to functions.)

	gcc/cp/
	* pt.c (instantiate_body): Remove 'nested' var, simplify
	push_to_top logic.
2020-09-16 08:10:44 -07:00
Tobias Burnus
91347c3bbf Fortran: OpenMP - fix simd with (last)private (PR97061)
gcc/fortran/ChangeLog:

	PR fortran/97061
	* trans-openmp.c (gfc_trans_omp_do): Handle simd with (last)private.

gcc/testsuite/ChangeLog:

	PR fortran/97061
	* gfortran.dg/gomp/openmp-simd-6.f90: New test.
2020-09-16 16:23:13 +02:00
Nathan Sidwell
2b7147e485 c++: Break out actual instantiation from instantiate_decl
This refactors instantiate_decl, breaking out the actual instantiation
work to instantiate_body.  That'll allow me to address the OMP UDR
issue, but it also means we have slightly neater code in
instantiate_decl anyway.

	gcc/cp/
	* pt.c (instantiate_body): New, broken out of ..
	(instantiate_decl): ... here.  Call it.
2020-09-16 07:19:48 -07:00
Andrea Corallo
052204fac5 vec: don't select partial vectors when unnecessary
gcc/ChangeLog

2020-09-09  Andrea Corallo  <andrea.corallo@arm.com>

	* tree-vect-loop.c (vect_need_peeling_or_partial_vectors_p): New
	function.
	(vect_analyze_loop_2): Make use of it not to select partial
	vectors if no peel is required.
	(determine_peel_for_niter): Move out some logic into
	'vect_need_peeling_or_partial_vectors_p'.

gcc/testsuite/ChangeLog

2020-09-09  Andrea Corallo  <andrea.corallo@arm.com>

	* gcc.target/aarch64/sve/cost_model_10.c: New test.
	* gcc.target/aarch64/sve/clastb_8.c: Update test for new
	vectorization strategy.
	* gcc.target/aarch64/sve/cost_model_5.c: Likewise.
	* gcc.target/aarch64/sve/struct_vect_14.c: Likewise.
	* gcc.target/aarch64/sve/struct_vect_15.c: Likewise.
	* gcc.target/aarch64/sve/struct_vect_16.c: Likewise.
	* gcc.target/aarch64/sve/struct_vect_17.c: Likewise.
2020-09-16 15:17:17 +02:00
H.J. Lu
453a20c657 rtl_data: Add sp_is_clobbered_by_asm
Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
pointer is clobbered by asm statement.

gcc/

	PR target/97032
	* cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
	to true if the stack pointer is clobbered by asm statement.
	* emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
	* config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
	if the stack pointer is clobbered by asm statement.

gcc/testsuite/

	PR target/97032
	* gcc.target/i386/pr97032.c: New test.
2020-09-16 05:26:19 -07:00
Feng Xue
f419a01589 testsuite/97066 - minor change to bypass plusminus-with-convert rule
The following testcases will be simplified by the new rule
(T)(A) +- (T)(B) -> (T)(A +- B), so could not keep code pattern
expected by test-check. Adjust test code to suppress simplification.

2020-09-16  Feng Xue  <fxue@os.amperecomputing.com>

gcc/testsuite/
	PR testsuite/97066
	* gcc.dg/ifcvt-3.c: Modified to suppress simplification.
	* gcc.dg/tree-ssa/20030807-10.c: Likewise.
2020-09-16 20:20:38 +08:00
Ilya Leoshkevich
2cab2431d5 IBM Z: Fix *vec_tf_to_v1tf constraints
Certain alternatives of *vec_tf_to_v1tf use "v" constraint for its
TFmode source operand.  Therefore it is assigned to VEC_REGS class,
and when it is reloaded using *movtf_64, whose relevant alternatives
need FP_REGS, LRA loops and ICE happens.  The reason is that register
class mismatch causes LRA to emit another reload, which triggers this
issue again.

Fix by using "f" constraint, which is more appropriate for FP register
pairs anyway.

gcc/ChangeLog:

2020-09-02  Ilya Leoshkevich  <iii@linux.ibm.com>

	* config/s390/vector.md(*vec_tf_to_v1tf): Use "f" instead of "v"
	  for the source operand.
2020-09-16 14:16:34 +02:00
Jojo R
d66f83c25b C-SKY: Refine target name for elf target test
gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_profiling_available): Refine name of elf target.
2020-09-16 19:34:14 +08:00
Jojo R
f8ede8875e C-SKY: Set use_gcc_stdint=wrap for elf target
gcc/ChangeLog:

	* config.gcc (C-SKY): Set use_gcc_stdint=wrap for elf target.
2020-09-16 19:34:09 +08:00
Jojo R
03380ecc38 C-SKY: Enable crtbegin/crtend.o of libgcc for elf target
libgcc/ChangeLog:

	* config.host (C-SKY): Enable crtbegin/crtend.o of libgcc for elf target.
2020-09-16 19:34:02 +08:00
Richard Biener
f02b2077c0 remove STMT_VINFO_NUM_SLP_USES
This removes STMT_VINFO_NUM_SLP_USES by pushing the setting of
the shared stmt_vec_info vector type to where we actually need it
which is alignment analysis and vectorizable_* analysis (where
we could eventually elide it for non-load/store operations).

In particular "uses" in the cache and in disqualified SLP
subgraphs should no longer provide conflicting vector types
this way.

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

	* tree-vectorizer.h (_stmt_vec_info::num_slp_uses): Remove.
	(STMT_VINFO_NUM_SLP_USES): Likewise.
	(vect_free_slp_instance): Adjust.
	(vect_update_shared_vectype): Declare.
	* tree-vectorizer.c (vec_info::~vec_info): Adjust.
	* tree-vect-loop.c (vect_analyze_loop_2): Likewise.
	(vectorizable_live_operation): Use vector type from
	SLP_TREE_REPRESENTATIVE.
	(vect_transform_loop): Adjust.
	* tree-vect-data-refs.c (vect_slp_analyze_node_alignment):
	Set the shared vector type.
	* tree-vect-slp.c (vect_free_slp_tree): Remove final_p
	parameter, remove STMT_VINFO_NUM_SLP_USES updating.
	(vect_free_slp_instance): Adjust.
	(vect_create_new_slp_node): Remove STMT_VINFO_NUM_SLP_USES
	updating.
	(vect_update_shared_vectype): Always compare with the
	present vector type, update if NULL.
	(vect_build_slp_tree_1): Do not update the shared vector
	type here.
	(vect_build_slp_tree_2): Adjust.
	(slp_copy_subtree): Likewise.
	(vect_attempt_slp_rearrange_stmts): Likewise.
	(vect_analyze_slp_instance): Likewise.
	(vect_analyze_slp): Likewise.
	(vect_slp_analyze_node_operations_1): Update the shared
	vector type.
	(vect_slp_analyze_operations): Adjust.
	(vect_slp_analyze_bb_1): Likewise.
2020-09-16 12:28:10 +02:00
Jojo R
8a4f343aa3 C-SKY: Support multilib for mfloat-abi=.
gcc/ChangeLog:

	* config/csky/t-csky-linux (CSKY_MULTILIB_OSDIRNAMES): Use mfloat-abi.
	(MULTILIB_OPTIONS): Likewise.
	* config/csky/t-csky-elf (MULTILIB_OPTIONS): Likewise.
	(MULTILIB_EXCEPTIONS): Likewise.
2020-09-16 16:57:50 +08:00
Jakub Jelinek
3ba3c2e3a9 arm: Avoid unused parameter warning
2020-09-16  Jakub Jelinek  <jakub@redhat.com>

	* config/arm/arm.c (arm_option_restore): Comment out opts argument
	name to avoid unused parameter warnings.
2020-09-16 10:13:19 +02:00
Jakub Jelinek
d29a7cd6f4 options, lto: Optimize streaming of optimization nodes
When working on the previous patch, I've noticed that all cl_optimization
fields appart from strings are streamed with bp_pack_value (..., 64); so we
waste quite a lot of space, given that many of the options are just booleans
or char options and there are 450-ish of them.

Fixed by streaming the number of bits the corresponding fields have.
While for char fields we have also range information, except for 3
it is either -128, 127 or 0, 255, so it didn't seem worth it to bother
with using range-ish packing.

2020-09-16  Jakub Jelinek  <jakub@redhat.com>

	* optc-save-gen.awk: In cl_optimization_stream_out use
	bp_pack_var_len_{int,unsigned} instead of bp_pack_value.  In
	cl_optimization_stream_in use bp_unpack_var_len_{int,unsigned}
	instead of bp_unpack_value.  Formatting fix.
2020-09-16 10:04:32 +02:00
Jakub Jelinek
bd909071ac store-merging: Consider also overlapping stores earlier in the by bitpos sorting [PR97053]
As the testcases show, if we have something like:
  MEM <char[12]> [&b + 8B] = {};
  MEM[(short *) &b] = 5;
  _5 = *x_4(D);
  MEM <long long unsigned int> [&b + 2B] = _5;
  MEM[(char *)&b + 16B] = 88;
  MEM[(int *)&b + 20B] = 1;
then in sort_by_bitpos the stores are almost like in the given order,
except the first store is after the = _5; store.
We can't coalesce the = 5; store with = _5;, because the latter is MEM_REF,
while the former INTEGER_CST, and we can't coalesce the = _5 store with
the = {} store because the former is MEM_REF, the latter INTEGER_CST.
But we happily coalesce the remaining 3 stores, which is wrong, because the
= _5; store overlaps those and is in between them in the program order.
We already have code to deal with similar cases in check_no_overlap, but we
deal only with the following stores in sort_by_bitpos order, not the earlier
ones.

The following patch checks also the earlier ones.  In coalesce_immediate_stores
it computes the first one that needs to be checked (all the ones whose
bitpos + bitsize is smaller or equal to merged_store->start don't need to be
checked and don't need to be checked even for any following attempts because
of the sort_by_bitpos sorting) and the end of that (that is the first store
in the merged_store).

2020-09-16  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/97053
	* gimple-ssa-store-merging.c (check_no_overlap): Add FIRST_ORDER,
	START, FIRST_EARLIER and LAST_EARLIER arguments.  Return false if
	any stores between FIRST_EARLIER inclusive and LAST_EARLIER exclusive
	has order in between FIRST_ORDER and LAST_ORDER and overlaps the to
	be merged store.
	(imm_store_chain_info::try_coalesce_bswap): Add FIRST_EARLIER argument.
	Adjust check_no_overlap caller.
	(imm_store_chain_info::coalesce_immediate_stores): Add first_earlier
	and last_earlier variables, adjust them during iterations.  Adjust
	check_no_overlap callers, call check_no_overlap even when extending
	overlapping stores by extra INTEGER_CST stores.

	* gcc.dg/store_merging_31.c: New test.
	* gcc.dg/store_merging_32.c: New test.
2020-09-16 09:42:33 +02:00
Jojo R
2c45b9ee5c C-SKY: Fix wrong ld name with option -mfloat-abi=hard.
gcc/ChangeLog:

	* config/csky/csky-linux-elf.h (GLIBC_DYNAMIC_LINKER): Use mfloat-abi.
2020-09-16 14:57:19 +08:00
Kewen Lin
e0d98ffd14 rs6000: Remove useless insns fed into lvx/stvx [PR97019]
This patch is to extend the existing function find_alignment_op to
check all defintions of base_reg are AND operations with mask -16B
to force the alignment.  If all are satifised, it passes all AND
operations and instructions to function recombine_lvx_pattern
and recombine_stvx_pattern, they can remove all useless ANDs
further.

Bootstrapped/regtested on powerpc64le-linux-gnu P8.

gcc/ChangeLog:

	PR target/97019
	* config/rs6000/rs6000-p8swap.c (find_alignment_op): Adjust to
	support multiple defintions which are all AND operations with
	the mask -16B.
	(recombine_lvx_pattern): Adjust to handle multiple AND operations
	from find_alignment_op.
	(recombine_stvx_pattern): Likewise.

gcc/testsuite/ChangeLog:

	PR target/97019
	* gcc.target/powerpc/pr97019.c: New test.
2020-09-15 22:59:35 -05:00
Jojo R
01d56aeaff C-SKY: Support -mfloat-abi=hard.
gcc/ChangeLog:

	* config/csky/csky.md (CSKY_NPARM_FREGS): New.
	(call_value_internal_vs/d): New.
	(untyped_call): New.
	* config/csky/csky.h (TARGET_SINGLE_FPU): New.
	(TARGET_DOUBLE_FPU): New.
	(FUNCTION_VARG_REGNO_P): New.
	(CSKY_VREG_MODE_P): New.
	(FUNCTION_VARG_MODE_P): New.
	(CUMULATIVE_ARGS): Add extra regs info.
	(INIT_CUMULATIVE_ARGS): Use csky_init_cumulative_args.
	(FUNCTION_ARG_REGNO_P): Use FUNCTION_VARG_REGNO_P.
	* config/csky/csky-protos.h (csky_init_cumulative_args): Extern.
	* config/csky/csky.c (csky_cpu_cpp_builtins): Support TARGET_HARD_FLOAT_ABI.
	(csky_function_arg): Likewise.
	(csky_num_arg_regs): Likewise.
	(csky_function_arg_advance): Likewise.
	(csky_function_value): Likewise.
	(csky_libcall_value): Likewise.
	(csky_function_value_regno_p): Likewise.
	(csky_arg_partial_bytes): Likewise.
	(csky_setup_incoming_varargs): Likewise.
	(csky_init_cumulative_args): New.

gcc/testsuite/ChangeLog:

	* gcc.dg/builtin-apply2.c : Skip if CSKY.
	* gcc.dg/torture/stackalign/builtin-apply-2.c : Likewise.
2020-09-16 10:13:49 +08:00
Bill Schmidt
3f3f28de3f rs6000: Fix misnamed built-in
The description in rs6000-builtin.def provides for a builtin named
__builtin_altivec_xst_len_r.  However, it is hand-defined in
altivec_init_builtins as __builtin_xst_len_r, against the usual naming
practice.  Fix that.

2020-09-15  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (altivec_init_builtins): Fix name
	of __builtin_altivec_xst_len_r.
2020-09-15 20:34:22 -05:00
Than McIntosh
1d7d3f91ab libgo: additional type/const references in sysinfo.c
Add a few more explicit references to enumeration constants
(RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums
are emitted into DWARF, when using a clang host compiler during
the gollvm build.

Updates golang/go#41382.
Updates golang/go#41404.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
2020-09-15 17:41:57 -07:00
GCC Administrator
9f7ab8c561 Daily bump. 2020-09-16 00:16:37 +00:00
David Malcolm
50ddbd0282 analyzer: fix ICE when merging constraints w/o transitivity [PR96650]
PR analyzer/96650 reports an assertion failure when merging the
intersection of two sets of constraints, due to the resulting
constraints being infeasible.

It turns out that the two input sets were each infeasible if
transitivity were considered, but -fanalyzer-transitivity was off.
However for this case, the merging code was "discovering" the
transitive infeasibility of the intersection of the constraints even
when -fanalyzer-transitivity is off, triggering an assertion failure.

I attempted various fixes for this, but each of them would have
introduced O(N^2) logic into the constraint-handling code into the
-fno-analyzer-transitivity case (with N == the number of constraints).

This patch fixes the ICE by tweaking the assertion, so that we
silently drop such constraints if -fanalyzer-transitivity is off.

gcc/analyzer/ChangeLog:
	PR analyzer/96650
	* constraint-manager.cc (merger_fact_visitor::on_fact): Replace
	assertion that add_constraint succeeded with an assertion that
	if it fails, -fanalyzer-transitivity is off.

gcc/testsuite/ChangeLog:
	PR analyzer/96650
	* gcc.dg/analyzer/pr96650-1-notrans.c: New test.
	* gcc.dg/analyzer/pr96650-1-trans.c: New test.
	* gcc.dg/analyzer/pr96650-2-notrans.c: New test.
	* gcc.dg/analyzer/pr96650-2-trans.c: New test.
2020-09-15 17:46:13 -04:00
Tobias Burnus
1b9bdd5203 libgomp/target.c: Silence -Wuninitialized warning
libgomp/ChangeLog:

	PR fortran/96668
	* target.c (gomp_map_vars_internal): Initialize has_nullptr.
2020-09-15 21:28:40 +02:00
Ilya Leoshkevich
d1a31689a7 rtlanal: fix subreg handling in set_noop_p ()
The following s390 rtx is errneously considered a no-op:

(set (subreg:DF (reg:TF %f0) 8) (subreg:DF (reg:V1TF %f0) 8))

Here, SET_DEST is a second register in a floating-point register pair,
and SET_SRC is the second half of a vector register, so they refer to
different bits.

Fix by treating subregs of registers in different modes conservatively.

gcc/ChangeLog:

2020-09-11  Ilya Leoshkevich  <iii@linux.ibm.com>

	* rtlanal.c (set_noop_p): Treat subregs of registers in
	different modes conservatively.
2020-09-15 19:30:37 +02:00
Richard Biener
d876184c09 make swap argument of vect_get_and_check_slp_defs readonly
Since some time we're only using this argument to communicate from
vect_build_slp_tree_1 to vect_get_and_check_slp_defs.  This makes
the direction of information flow clear.

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

	* tree-vect-slp.c (vect_get_and_check_slp_defs): Make swap
	argument by-value and do not change it.
	(vect_build_slp_tree_2): Adjust, set swap to NULL after last
	use.
2020-09-15 16:59:09 +02:00
Nathan Sidwell
3304888c25 c++: Partially revert: local externs in templates do not get template head
Turns out I didn't get OMP reductions correct.  To address those I
need to do some reorganization, so this patch just reverts the
OMP-specific pieces of the local decl changes.

	gcc/cp/
	* pt.c (push_template_decl_real): OMP reductions retain a template
	header.
	(tsubst_function_decl): Likewise.
2020-09-15 07:57:00 -07:00
Feng Xue
8f0d743c2d tree-optimization/94234 - add plusminus-with-convert pattern
Add a rule (T)(A) +- (T)(B) -> (T)(A +- B), which works only when (A +- B)
could be folded to a simple value. By this rule, a plusminus-mult-with-convert
expression could be handed over to the rule (A * C) +- (B * C) -> (A +- B).

2020-09-15  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
	PR tree-optimization/94234
	* match.pd (T)(A) +- (T)(B) -> (T)(A +- B): New simplification.

gcc/testsuite/
	PR tree-optimization/94234
	* gcc.dg/pr94234-3.c: New test.
2020-09-15 22:51:28 +08:00
H.J. Lu
9e89fa0e2d gcc.target/i386/pr78904-4a.c: Compile with -mtune=generic
commit e95395926a
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Thu Jun 18 20:12:48 2020 +0200

    i386: Fix mode of ZERO_EXTRACT RTXes, remove ext_register_operand predicate.

caused

FAIL: gcc.target/i386/pr78904-4a.c scan-assembler [ \t]movb[\t ]+%.h, t

when compiled with --target_board='unix{-m32\ -march=cascadelake}'.  With
-mtune=generic:

	movzwl	4(%esp), %edx
	movl	8(%esp), %eax
	movb	%dh, t(%eax)
	ret

With -mtune=cascadelake:

	movzbl	5(%esp), %edx
	movl	8(%esp), %eax
	movb	%dl, t(%eax)
	ret

Add -mtune=generic for --target_board='unix{-m32\ -march=cascadelake}'.

	* gcc.target/i386/pr78904-4a.c: Compile with -mtune=generic.
2020-09-15 07:35:46 -07:00
Segher Boessenkool
bab5813816 bb-reorder: Fix for ICEs caused by 69ca5f3a98
After the previous patch we are left with an unreachable BB.  This will
ICE if either we have -fschedule-fusion, or we do not have peephole2.

2020-09-15  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/96475
	* bb-reorder.c (duplicate_computed_gotos): If we did anything, run
	cleanup_cfg.
2020-09-15 13:18:04 +00:00
Richard Biener
c9de716a59 Allow more BB vectorization
The following allows more BB vectorization by generally building leafs
from scalars rather than giving up.  Note this is only a first step
towards this and as can be seen with the exception for node splitting
it is generally hard to get this heuristic sound.  I've added variants
of the bb-slp-48.c testcase to make sure we still try permuting for
example.

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

	* tree-vect-slp.c (vect_build_slp_tree_2): Also consider
	building an operand from scalars when building it did not
	fail fatally but avoid messing with the upcall splitting
	of groups.

	* gcc.dg/vect/bb-slp-48.c: New testcase.
	* gcc.dg/vect/bb-slp-7.c: Adjust.
2020-09-15 14:41:21 +02:00
Andre Vieira
80297f8977 arm: Fix testisms introduced with fix for pr target/95646
This patch changes the test to use the effective-target machinery disables the
error message "ARMv8-M Security Extensions incompatible with selected FPU" when
-mfloat-abi=soft.
Further changes 'asm' to '__asm__' to avoid failures with '-std=' options.

gcc/ChangeLog:
2020-07-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* config/arm/arm.c (arm_options_perform_arch_sanity_checks): Do not
	check +D32 for CMSE if -mfloat-abi=soft

gcc/testsuite/ChangeLog:
2020-07-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/pr95646.c: Fix testism.
2020-09-15 11:25:09 +01:00
liuhongt
ecc3135a4a Retune mask <->integer cost for non-AVX512 micro-architecture.
gcc/ChangeLog:

	PR target/96744
	* config/i386/x86-tune-costs.h (struct processor_costs):
	Increase mask <-> integer cost for non AVX512 target to avoid
	spill gpr to mask. Also retune mask <-> integer and
	mask_load/store for skylake_cost.
2020-09-15 18:22:34 +08:00
Jakub Jelinek
0f079e104a i386: Fix up vector mul and div with broadcasts in -masm=intel mode
These patterns printed bogus <>s around the {1to16} and similar strings.

2020-09-15  Jakub Jelinek  <jakub@redhat.com>

	PR target/97028
	* config/i386/sse.md (mul<mode>3<mask_name>_bcs,
	<avx512>_div<mode>3<mask_name>_bcst): Use <avx512bcst> instead of
	<<avx512bcst>>.

	* gcc.target/i386/avx512f-pr97028.c: Untested fix.
2020-09-15 09:39:38 +02:00
Tobias Burnus
972da55746 OpenMP/Fortran: Fix (re)mapping of allocatable/pointer arrays [PR96668]
gcc/cp/ChangeLog:

	PR fortran/96668
	* cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
	* cp-tree.h (cxx_omp_finish_clause): Likewise
	* semantics.c (handle_omp_for_class_iterator): Update call.

gcc/fortran/ChangeLog:

	PR fortran/96668
	* trans.h (gfc_omp_finish_clause): Add bool openacc arg.
	* trans-openmp.c (gfc_omp_finish_clause): Ditto. Use
	GOMP_MAP_ALWAYS_POINTER with PSET for pointers.
	(gfc_trans_omp_clauses): Like the latter and also if the always
	modifier is used.

gcc/ChangeLog:

	PR fortran/96668
	* gimplify.c (gimplify_omp_for): Add 'bool openacc' argument;
	update omp_finish_clause calls.
	(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses,
	gimplify_expr, gimplify_omp_loop): Update omp_finish_clause
	and/or gimplify_for calls.
	* langhooks-def.h (lhd_omp_finish_clause): Add bool openacc arg.
	* langhooks.c (lhd_omp_finish_clause): Likewise.
	* langhooks.h (lhd_omp_finish_clause): Likewise.
	* omp-low.c (scan_sharing_clauses): Keep GOMP_MAP_TO_PSET cause for
	'declare target' vars.

include/ChangeLog:

	PR fortran/96668
	* gomp-constants.h (GOMP_MAP_ALWAYS_POINTER_P): Define.

libgomp/ChangeLog:

	PR fortran/96668
	* libgomp.h (struct target_var_desc): Add has_null_ptr_assoc member.
	* target.c (gomp_map_vars_existing): Add always_to_flag flag.
	(gomp_map_vars_existing): Update call to it.
	(gomp_map_fields_existing): Likewise
	(gomp_map_vars_internal): Update PSET handling such that if a nullptr is
	now allocated or if GOMP_MAP_POINTER is used PSET is updated and pointer
	remapped.
	(GOMP_target_enter_exit_data): Hanlde GOMP_MAP_ALWAYS_POINTER like
	GOMP_MAP_POINTER.
	* testsuite/libgomp.fortran/map-alloc-ptr-1.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-ptr-2.f90: New test.
2020-09-15 09:24:47 +02:00
Feng Xue
f9d2def016 tree-optimization/94234 - Fold plusminus_mult expr with multi-use operands
2020-09-03  Feng Xue  <fxue@os.amperecomputing.com>

gcc/
	PR tree-optimization/94234
	* genmatch.c (dt_simplify::gen_1): Emit check on final simplification
	result when "!" is specified on toplevel output expr.
	* match.pd ((A * C) +- (B * C) -> (A +- B) * C): Allow folding on expr
	with multi-use operands if final result is a simple gimple value.

gcc/testsuite/
	PR tree-optimization/94234
	* gcc.dg/pr94234-2.c: New test.
2020-09-15 11:14:01 +08:00
GCC Administrator
50a71cd018 Daily bump. 2020-09-15 00:16:37 +00:00
Sergei Trofimovich
0620f4d79e doc: fix spelling of -fprofile-reproducibility
gcc/ChangeLog:

	* doc/invoke.texi: fix '-fprofile-reproducibility' option
	spelling in manual.
2020-09-14 23:31:34 +01:00
Ian Lance Taylor
05f40bc4c1 libbacktrace: support MiniDebugInfo
libbacktrace/ChangeLog:
	PR libbacktrace/93608
	Add support for MiniDebugInfo.
	* elf.c (struct elf_view): Define.  Replace most uses of
	backtrace_view with elf_view.
	(elf_get_view): New static functions.  Replace most calls of
	backtrace_get_view with elf_get_view.
	(elf_release_view): New static functions.  Replace most calls of
	backtrace_release_view with elf_release_view.
	(elf_uncompress_failed): Rename from elf_zlib_failed.  Change all
	callers.
	(LZMA_STATES, LZMA_POS_STATES, LZMA_DIST_STATES): Define.
	(LZMA_DIST_SLOTS, LZMA_DIST_MODEL_START): Define.
	(LZMA_DIST_MODEL_END, LZMA_FULL_DISTANCES): Define.
	(LZMA_ALIGN_SIZE, LZMA_LEN_LOW_SYMBOLS): Define.
	(LZMA_LEN_MID_SYMBOLS, LZMA_LEN_HIGH_SYMBOLS): Define.
	(LZMA_LITERAL_CODERS_MAX, LZMA_LITERAL_CODER_SIZE): Define.
	(LZMA_PROB_IS_MATCH_LEN, LZMA_PROB_IS_REP_LEN): Define.
	(LZMA_PROB_IS_REP0_LEN, LZMA_PROB_IS_REP1_LEN): Define.
	(LZMA_PROB_IS_REP2_LEN, LZMA_PROB_IS_REP0_LONG_LEN): Define.
	(LZMA_PROB_DIST_SLOT_LEN, LZMA_PROB_DIST_SPECIAL_LEN): Define.
	(LZMA_PROB_DIST_ALIGN_LEN): Define.
	(LZMA_PROB_MATCH_LEN_CHOICE_LEN): Define.
	(LZMA_PROB_MATCH_LEN_CHOICE2_LEN): Define.
	(LZMA_PROB_MATCH_LEN_LOW_LEN): Define.
	(LZMA_PROB_MATCH_LEN_MID_LEN): Define.
	(LZMA_PROB_MATCH_LEN_HIGH_LEN): Define.
	(LZMA_PROB_REP_LEN_CHOICE_LEN): Define.
	(LZMA_PROB_REP_LEN_CHOICE2_LEN): Define.
	(LZMA_PROB_REP_LEN_LOW_LEN): Define.
	(LZMA_PROB_REP_LEN_MID_LEN): Define.
	(LZMA_PROB_REP_LEN_HIGH_LEN): Define.
	(LZMA_PROB_LITERAL_LEN): Define.
	(LZMA_PROB_IS_MATCH_OFFSET, LZMA_PROB_IS_REP_OFFSET): Define.
	(LZMA_PROB_IS_REP0_OFFSET, LZMA_PROB_IS_REP1_OFFSET): Define.
	(LZMA_PROB_IS_REP2_OFFSET): Define.
	(LZMA_PROB_IS_REP0_LONG_OFFSET): Define.
	(LZMA_PROB_DIST_SLOT_OFFSET): Define.
	(LZMA_PROB_DIST_SPECIAL_OFFSET): Define.
	(LZMA_PROB_DIST_ALIGN_OFFSET): Define.
	(LZMA_PROB_MATCH_LEN_CHOICE_OFFSET): Define.
	(LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET): Define.
	(LZMA_PROB_MATCH_LEN_LOW_OFFSET): Define.
	(LZMA_PROB_MATCH_LEN_MID_OFFSET): Define.
	(LZMA_PROB_MATCH_LEN_HIGH_OFFSET): Define.
	(LZMA_PROB_REP_LEN_CHOICE_OFFSET): Define.
	(LZMA_PROB_REP_LEN_CHOICE2_OFFSET): Define.
	(LZMA_PROB_REP_LEN_LOW_OFFSET): Define.
	(LZMA_PROB_REP_LEN_MID_OFFSET): Define.
	(LZMA_PROB_REP_LEN_HIGH_OFFSET): Define.
	(LZMA_PROB_LITERAL_OFFSET): Define.
	(LZMA_PROB_TOTAL_COUNT): Define.
	(LZMA_IS_MATCH, LZMA_IS_REP, LZMA_IS_REP0): Define.
	(LZMA_IS_REP1, LZMA_IS_REP2, LZMA_IS_REP0_LONG): Define.
	(LZMA_DIST_SLOT, LZMA_DIST_SPECIAL, LZMA_DIST_ALIGN): Define.
	(LZMA_MATCH_LEN_CHOICE, LZMA_MATCH_LEN_CHOICE2): Define.
	(LZMA_MATCH_LEN_LOW, LZMA_MATCH_LEN_MID): Define.
	(LZMA_MATCH_LEN_HIGH, LZMA_REP_LEN_CHOICE): Define.
	(LZMA_REP_LEN_CHOICE2, LZMA_REP_LEN_LOW): Define.
	(LZMA_REP_LEN_MID, LZMA_REP_LEN_HIGH, LZMA_LITERAL): Define.
	(elf_lzma_varint): New static function.
	(elf_lzma_range_normalize): New static function.
	(elf_lzma_bit, elf_lzma_integer): New static functions.
	(elf_lzma_reverse_integer): New static function.
	(elf_lzma_len, elf_uncompress_lzma_block): New static functions.
	(elf_uncompress_lzma): New static function.
	(backtrace_uncompress_lzma): New function.
	(elf_add): Add memory and memory_size parameters.  Change all
	callers.  Look for .gnu_debugdata section, and, if found,
	decompress it and use it for symbols and debug info.  Permit the
	descriptor parameter to be -1.
	* internal.h (backtrace_uncompress_lzma): Declare.
	* mtest.c: New file.
	* xztest.c: New file.
	* configure.ac: Check for nm, xz, and comm programs.  Check for
	liblzma library.
	(HAVE_MINIDEBUG): Define.
	* Makefile.am (mtest_SOURCES): Define.
	(mtest_CFLAGS, mtest_LDADD): Define.
	(TESTS): Add mtest_minidebug if HAVE_MINIDEBUG.
	(%_minidebug): New pattern rule, if HAVE_MINIDEBUG.
	(xztest_SOURCES, xztest_CFLAGS, xztest_LDADD): Define.
	(xztest_alloc_SOURCES, xztest_alloc_CFLAGS): Define
	(xztest_alloc_LDADD): Define.
	(BUILDTESTS): Add mtest, xztest, xztest_alloc.
	(CLEANFILES): Add files created by minidebug pattern.
	(btest.lo): Correct INCDIR reference.
	(mtest.lo, xztest.lo, ztest.lo): New targets.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* Makefile.in: Regenerate.
2020-09-14 14:11:17 -07:00
Marek Polacek
cd6743e9c4 c++: Use VAR_OR_FUNCTION_DECL_P.
gcc/cp/ChangeLog:

	* pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
2020-09-14 15:00:42 -04:00
Jose E. Marchesi
5bcc0fa05e bpf: use the expected instruction for NOPs
The BPF ISA doesn't have a no-operation instruction, but in practice
the Linux kernel verifier performs some optimizations that rely on
these instructions to be encoded in a particular way.  As it turns
out, we were using the "wrong" instruction in GCC.

This patch makes GCC to generate the expected instruction for NOP (a
`ja 0') and also adds a test to make sure this is the case.

Tested in bpf-unknown-none targets.

2020-09-14  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/

	* config/bpf/bpf.md ("nop"): Re-define as `ja 0'.

gcc/testsuite/

	* gcc.target/bpf/nop-1.c: New test.
2020-09-14 20:55:13 +02:00
Iain Sandoe
0a3e6e975a Darwin, X86, testsuite: Fix pr87767 tests for Darwin.
The tests assume non-PIC for m32 (which means that they fail on default
PIC targets, like Darwin).  There is also a missing space before the
closing '}' on one of the dg-require-effective-target which means that
test fails on machines without avx512f.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512f-broadcast-pr87767-1.c: Make the test
	run as non-dynamic for m32 Darwin.
	* gcc.target/i386/avx512f-broadcast-pr87767-3.c: Likewise.
	* gcc.target/i386/avx512f-broadcast-pr87767-5.c: Likewise.
	* gcc.target/i386/avx512f-broadcast-pr87767-7.c: Likewise.
	* gcc.target/i386/avx512vl-broadcast-pr87767-1.c: Likewise.
	* gcc.target/i386/avx512vl-broadcast-pr87767-3.c: Likewise.
	* gcc.target/i386/avx512vl-broadcast-pr87767-5.c: Likewise.
	* gcc.target/i386/avx512f-broadcast-pr87767-6.c: Adjust dg-requires
	clause.
2020-09-14 19:45:35 +01:00
Nathan Sidwell
e9fdb9a732 c++: local externs in templates do not get template head
Now we consistently mark local externs with DECL_LOCAL_DECL_P, we can
teach the template machinery not to give them a TEMPLATE_DECL head,
and the instantiation machinery treat them as the local specialiations
they are.  (openmp UDRs also fall into this category, and are dealt
with similarly.)

	gcc/cp/
	* pt.c (push_template_decl_real): Don't attach a template head to
	local externs.
	(tsubst_function_decl): Add support for headless local extern
	decls.
	(tsubst_decl): Add support for headless local extern decls.
2020-09-14 09:45:24 -07:00
David Malcolm
05ab8befe1 analyzer: add -param=analyzer-max-constraints=
On attempting to run the full test suite with -fanalyzer via
  make check RUNTESTFLAGS="-v -v --target_board=unix/-fanalyzer"
I saw it get stuck on:
  gcc.c-torture/compile/20001226-1.c
It turns out this was on a debug build, rather than a release build;
but a release build with -fanalyzer took:
  real 1m33.689s
  user 1m30.239s
  sys  0m2.727s
as compared to:
  real 0m2.361s
  user 0m2.107s
  sys  0m0.214s
without -fanalyzer.

This torture test performs 64 * 64 uniqely-coded comparisons between
elements of a pair of arrays until it finds an element that's different,
leading to an accumulation of 4096 constraints along the path where
no difference is found.

"perf" shows most of the time is spent in canonicalizing and copying
constraint_manager instances, presumably as it copies and merges states
with increasingly more complex sets of constraints as it analyzes
further along the "no differences yet" path.

This patch crudely works around this by adding a
  -param=analyzer-max-constraints=
limit, defaulting to 20, above which constraints will be silently
dropped.  With this -fanalyzer takes:
  real 0m6.935s
  user 0m6.413s
  sys  0m0.396s
on the above case.

gcc/analyzer/ChangeLog:
	* analyzer.opt (-param=analyzer-max-constraints=): New param.
	* constraint-manager.cc
	(constraint_manager::add_constraint_internal): Silently reject
	attempts to add constraints when the above limit is reached.
2020-09-14 12:29:35 -04:00