aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-06-24c: Fix up c_parser_has_attribute_expression [PR101176]Jakub Jelinek1-0/+3
This function keeps src_range member of the result uninitialized, which at least under valgrind can show up later when those uninitialized location_t's can make it into the IL or location_t hash tables. 2021-06-24 Jakub Jelinek <jakub@redhat.com> PR c/101176 * c-parser.c (c_parser_has_attribute_expression): Set source range for the result.
2021-06-24c: Fix C cast error-recovery [PR101171]Jakub Jelinek2-0/+14
The following testcase ICEs during error-recovery, as build_c_cast calls note_integer_operands on error_mark_node and that wraps it into C_MAYBE_CONST_EXPR which is unexpected and causes ICE later on. Seems most other callers of note_integer_operands check early if something is error_mark_node and return before calling note_integer_operands on it. The following patch fixes it by not calling on error_mark_node, another possibility would be to handle error_mark_node in note_integer_operands and just return it. 2021-06-24 Jakub Jelinek <jakub@redhat.com> PR c/101171 * c-typeck.c (build_c_cast): Don't call note_integer_operands on error_mark_node. * gcc.dg/pr101171.c: New test.
2021-06-24i386: Add pack/unpack patterns for 64bit vectors [PR89021]Uros Bizjak6-17/+130
2021-06-24 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/89021 * config/i386/i386-expand.c (ix86_expand_sse_unpack): Handle V8QI and V4HI modes. * config/i386/mmx.md (sse4_1_<any_extend:code>v4qiv4hi2): New insn pattern. (sse4_1_<any_extend:code>v4qiv4hi2): Ditto. (mmxpackmode): New mode attribute. (vec_pack_trunc_<mmxpackmode:mode>): New expander. (mmxunpackmode): New mode attribute. (vec_unpacks_lo_<mmxunpackmode:mode>): New expander. (vec_unpacks_hi_<mmxunpackmode:mode>): Ditto. (vec_unpacku_lo_<mmxunpackmode:mode>): Ditto. (vec_unpacku_hi_<mmxunpackmode:mode>): Ditto. * config/i386/i386.md (extsuffix): Move from ... * config/i386/sse.md: ... here. gcc/testsuite/ PR target/89021 * gcc.dg/vect/vect-nb-iter-ub-3.c (dg-additional-options): Add --param vect-epilogues-nomask=0. * gcc.target/i386/pr97249-1.c (foo): Add #pragma GCC unroll to avoid loop vectorization. (foo1): Ditto. (foo2): Ditto.
2021-06-24Emit .file 0 directive earlier in DWARF 5Eric Botcazou1-21/+24
When the assembler supports it, the compiler automatically passes --gdwarf-5 to it, which has an interesting side effect: any assembly instruction prior to the first .file directive defines a new line associated with .file 0 in the .debug_line section and of course the numbering of these implicit lines has nothing to do with that of the source code. This can be problematic in Ada when we do not generate .file/.loc directives for compiled-generated functions to avoid too jumpy a debugging experience. gcc/ * dwarf2out.c (dwarf2out_assembly_start): Emit .file 0 marker here.. (dwarf2out_finish): ...instead of here.
2021-06-24Fix --gdwarf-5 configure tests for WindowsEric Botcazou2-26/+46
The issues are that 1) they use readelf instead of objdump and 2) they use ELF syntax in the assembly code. gcc/ * configure.ac (--gdwarf-5 option): Use objdump instead of readelf. (working --gdwarf-4/--gdwarf-5 for all sources): Likewise. (--gdwarf-4 not refusing generated .debug_line): Adjust for Windows. * configure: Regenerate.
2021-06-24Merge vec_addsub patternsRichard Biener1-57/+24
This merges the vec_addsub<mode>3 patterns using a mode attribute for the vec_merge merge operand. 2021-06-18 Richard Biener <rguenther@suse.de> * config/i386/sse.md (vec_addsubv4df3, vec_addsubv2df3, vec_addsubv8sf3, vec_addsubv4sf3): Merge into ... (vec_addsub<mode>3): ... using a new addsub_cst mode attribute.
2021-06-24Add x86 addsub SLP patternRichard Biener14-9/+350
This addds SLP pattern recognition for the SSE3/AVX [v]addsubp{ds} v0, v1 instructions which compute { v0[0] - v1[0], v0[1], + v1[1], ... } thus subtract, add alternating on lanes, starting with subtract. It adds a corresponding optab and direct internal function, vec_addsub$a3 and renames the existing i386 backend patterns to the new canonical name. The SLP pattern matches the exact alternating lane sequence rather than trying to be clever and anticipating incoming permutes - we could permute the two input vectors to the needed lane alternation, do the addsub and then permute the result vector back but that's only profitable in case the two input or the output permute will vanish - something Tamars refactoring of SLP pattern recog should make possible. 2021-06-17 Richard Biener <rguenther@suse.de> * config/i386/sse.md (avx_addsubv4df3): Rename to vec_addsubv4df3. (avx_addsubv8sf3): Rename to vec_addsubv8sf3. (sse3_addsubv2df3): Rename to vec_addsubv2df3. (sse3_addsubv4sf3): Rename to vec_addsubv4sf3. * config/i386/i386-builtin.def: Adjust. * internal-fn.def (VEC_ADDSUB): New internal optab fn. * optabs.def (vec_addsub_optab): New optab. * tree-vect-slp-patterns.c (class addsub_pattern): New. (slp_patterns): Add addsub_pattern. * tree-vect-slp.c (vect_optimize_slp): Disable propagation across CFN_VEC_ADDSUB. * tree-vectorizer.h (vect_pattern::vect_pattern): Make m_ops optional. * doc/md.texi (vec_addsub<mode>3): Document. * gcc.target/i386/vect-addsubv2df.c: New testcase. * gcc.target/i386/vect-addsubv4sf.c: Likewise. * gcc.target/i386/vect-addsubv4df.c: Likewise. * gcc.target/i386/vect-addsubv8sf.c: Likewise. * gcc.target/i386/vect-addsub-2.c: Likewise. * gcc.target/i386/vect-addsub-3.c: Likewise.
2021-06-24df: Fix up handling of paradoxical subregs in debug insns [PR101170]Jakub Jelinek2-3/+52
The recent addition of gcc_assert (regno < endregno); triggers during glibc build on m68k. The problem is that RA decisions shouldn't depend on expressions in DEBUG_INSNs and those expressions can contain paradoxical subregs of certain pseudos. If RA then decides to allocate the pseudo to a register with very small hard register REGNO, we can trigger the new assert, as (int) subreg_regno_offset may be negative on big endian and the small REGNO + the negative offset can wrap around. The following patch in that case records the range from the REGNO 0 to endregno, before the addition of the assert as both regno and endregno are unsigned it wouldn't record anything at all silently. 2021-06-24 Jakub Jelinek <jakub@redhat.com> PR middle-end/101170 * df-scan.c (df_ref_record): For paradoxical big-endian SUBREGs where regno + subreg_regno_offset wraps around use 0 as starting regno. * gcc.dg/pr101170.c: New test.
2021-06-24stor-layout: Avoid DECL_BIT_FIELD_REPRESENTATIVE with NULL TREE_TYPE [PR101172]Jakub Jelinek2-1/+24
finish_bitfield_representative has an early out if the field after a bitfield has error_mark_node type, but that early out leads to TREE_TYPE of the DECL_BIT_FIELD_REPRESENTATIVE being NULL, which breaks assumptions on code that uses the DECL_BIT_FIELD_REPRESENTATIVE during error-recovery. The following patch instead sets TREE_TYPE of the representative to error_mark_node, something the users can deal with better. At this point the representative can be set as DECL_BIT_FIELD_REPRESENTATIVE for multiple bitfields, so making sure that we clear the DECL_BIT_FIELD_REPRESENTATIVE instead would be harder (but doable, e.g. with the error_mark_node TREE_TYPE set by this patch set some flag in the caller and if the flag is there, walk all the fields once again and clear all DECL_BIT_FIELD_REPRESENTATIVE that have error_mark_node TREE_TYPE). 2021-06-24 Jakub Jelinek <jakub@redhat.com> PR middle-end/101172 * stor-layout.c (finish_bitfield_representative): If nextf has error_mark_node type, set repr type to error_mark_node too. * gcc.dg/pr101172.c: New test.
2021-06-24IBM Z: Define NO_PROFILE_COUNTERSIlya Leoshkevich4-28/+20
s390 glibc does not need counters in the .data section, since it stores edge hits in its own data structure. Therefore counters only waste space and confuse diffing tools (e.g. kpatch), so don't generate them. gcc/ChangeLog: * config/s390/s390.c (s390_function_profiler): Ignore labelno parameter. * config/s390/s390.h (NO_PROFILE_COUNTERS): Define. gcc/testsuite/ChangeLog: * gcc.target/s390/mnop-mcount-m31-mzarch.c: Adapt to the new prologue size. * gcc.target/s390/mnop-mcount-m64.c: Likewise.
2021-06-24Fix SLP permute propagation errorRichard Biener1-7/+23
This fixes SLP permute propagation to not propagate across operations that have different semantics on different lanes like for example the recently added COMPLEX_ADD_ROT90. 2021-06-24 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_optimize_slp): Do not propagate across operations that have different semantics on different lanes.
2021-06-24openmp: in_reduction clause support on target constructJakub Jelinek13-134/+526
This patch adds support for in_reduction clause on target construct, though for now only for synchronous targets (without nowait clause). The encountering thread in that case runs the target task and blocks until the target region ends, so it is implemented by remapping it before entering the target, initializing the private copy if not yet initialized for the current thread and then using the remapped addresses for the mapping addresses. For nowait combined with in_reduction the patch contains a hack where the nowait clause is ignored. To implement it correctly, I think we would need to create a new private variable for the in_reduction and initialize it before doing the async target and adjust the map addresses to that private variable and then pass a function pointer to the library routine with code where the callback would remap the address to the current threads private variable and use in_reduction combiner to combine the private variable we've created into the thread's copy. The library would then need to make sure that the routine is called in some thread participating in the parallel (and not in an unshackeled thread). 2021-06-24 Jakub Jelinek <jakub@redhat.com> gcc/ * tree.h (OMP_CLAUSE_MAP_IN_REDUCTION): Document meaning for OpenMP. * gimplify.c (gimplify_scan_omp_clauses): For OpenMP map clauses with OMP_CLAUSE_MAP_IN_REDUCTION flag partially defer gimplification of non-decl OMP_CLAUSE_DECL. For OMP_CLAUSE_IN_REDUCTION on OMP_TARGET user outer_ctx instead of ctx for placeholders and initializer/combiner gimplification. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_MAP_IN_REDUCTION on target constructs. (lower_rec_input_clauses): Likewise. (lower_omp_target): Likewise. * omp-expand.c (expand_omp_target): Temporarily ignore nowait clause on target if in_reduction is present. gcc/c-family/ * c-common.h (enum c_omp_region_type): Add C_ORT_TARGET and C_ORT_OMP_TARGET. * c-omp.c (c_omp_split_clauses): For OMP_CLAUSE_IN_REDUCTION on combined target constructs also add map (always, tofrom:) clause. gcc/c/ * c-parser.c (omp_split_clauses): Pass C_ORT_OMP_TARGET instead of C_ORT_OMP for clauses on target construct. (OMP_TARGET_CLAUSE_MASK): Add in_reduction clause. (c_parser_omp_target): For non-combined target add map (always, tofrom:) clauses for OMP_CLAUSE_IN_REDUCTION. Pass C_ORT_OMP_TARGET to c_finish_omp_clauses. * c-typeck.c (handle_omp_array_sections): Adjust ort handling for addition of C_ORT_OMP_TARGET and simplify, mapping clauses are never present on C_ORT_*DECLARE_SIMD. (c_finish_omp_clauses): Likewise. Handle OMP_CLAUSE_IN_REDUCTION on C_ORT_OMP_TARGET, set OMP_CLAUSE_MAP_IN_REDUCTION on corresponding map clauses. gcc/cp/ * parser.c (cp_omp_split_clauses): Pass C_ORT_OMP_TARGET instead of C_ORT_OMP for clauses on target construct. (OMP_TARGET_CLAUSE_MASK): Add in_reduction clause. (cp_parser_omp_target): For non-combined target add map (always, tofrom:) clauses for OMP_CLAUSE_IN_REDUCTION. Pass C_ORT_OMP_TARGET to finish_omp_clauses. * semantics.c (handle_omp_array_sections_1): Adjust ort handling for addition of C_ORT_OMP_TARGET and simplify, mapping clauses are never present on C_ORT_*DECLARE_SIMD. (handle_omp_array_sections): Likewise. (finish_omp_clauses): Likewise. Handle OMP_CLAUSE_IN_REDUCTION on C_ORT_OMP_TARGET, set OMP_CLAUSE_MAP_IN_REDUCTION on corresponding map clauses. * pt.c (tsubst_expr): Pass C_ORT_OMP_TARGET instead of C_ORT_OMP for clauses on target construct. gcc/testsuite/ * c-c++-common/gomp/target-in-reduction-1.c: New test. * c-c++-common/gomp/clauses-1.c: Add in_reduction clauses on target or combined target constructs. libgomp/ * testsuite/libgomp.c-c++-common/target-in-reduction-1.c: New test. * testsuite/libgomp.c-c++-common/target-in-reduction-2.c: New test. * testsuite/libgomp.c++/target-in-reduction-1.C: New test. * testsuite/libgomp.c++/target-in-reduction-2.C: New test.
2021-06-24predcom: Refactor more by encapsulating global statesKewen Lin1-174/+309
This patch is to encapsulate global states into a class and making their accessors as member functions, remove some consequent useless clean up code, and do some clean up with RAII. Bootstrapped/regtested on powerpc64le-linux-gnu P9, x86_64-redhat-linux and aarch64-linux-gnu, also bootstrapped on ppc64le P9 with bootstrap-O3 config. gcc/ChangeLog: * tree-predcom.c (class pcom_worker): New class. (release_chain): Renamed to... (pcom_worker::release_chain): ...this. (release_chains): Renamed to... (pcom_worker::release_chains): ...this. (aff_combination_dr_offset): Renamed to... (pcom_worker::aff_combination_dr_offset): ...this. (determine_offset): Renamed to... (pcom_worker::determine_offset): ...this. (class comp_ptrs): New class. (split_data_refs_to_components): Renamed to... (pcom_worker::split_data_refs_to_components): ...this, and update with class comp_ptrs. (suitable_component_p): Renamed to... (pcom_worker::suitable_component_p): ...this. (filter_suitable_components): Renamed to... (pcom_worker::filter_suitable_components): ...this. (valid_initializer_p): Renamed to... (pcom_worker::valid_initializer_p): ...this. (find_looparound_phi): Renamed to... (pcom_worker::find_looparound_phi): ...this. (add_looparound_copies): Renamed to... (pcom_worker::add_looparound_copies): ...this. (determine_roots_comp): Renamed to... (pcom_worker::determine_roots_comp): ...this. (determine_roots): Renamed to... (pcom_worker::determine_roots): ...this. (single_nonlooparound_use): Renamed to... (pcom_worker::single_nonlooparound_use): ...this. (remove_stmt): Renamed to... (pcom_worker::remove_stmt): ...this. (execute_pred_commoning_chain): Renamed to... (pcom_worker::execute_pred_commoning_chain): ...this. (execute_pred_commoning): Renamed to... (pcom_worker::execute_pred_commoning): ...this. (struct epcc_data): New member worker. (execute_pred_commoning_cbck): Call execute_pred_commoning with pcom_worker pointer. (find_use_stmt): Renamed to... (pcom_worker::find_use_stmt): ...this. (find_associative_operation_root): Renamed to... (pcom_worker::find_associative_operation_root): ...this. (find_common_use_stmt): Renamed to... (pcom_worker::find_common_use_stmt): ...this. (combinable_refs_p): Renamed to... (pcom_worker::combinable_refs_p): ...this. (reassociate_to_the_same_stmt): Renamed to... (pcom_worker::reassociate_to_the_same_stmt): ...this. (stmt_combining_refs): Renamed to... (pcom_worker::stmt_combining_refs): ...this. (combine_chains): Renamed to... (pcom_worker::combine_chains): ...this. (try_combine_chains): Renamed to... (pcom_worker::try_combine_chains): ...this. (prepare_initializers_chain): Renamed to... (pcom_worker::prepare_initializers_chain): ...this. (prepare_initializers): Renamed to... (pcom_worker::prepare_initializers): ...this. (prepare_finalizers_chain): Renamed to... (pcom_worker::prepare_finalizers_chain): ...this. (prepare_finalizers): Renamed to... (pcom_worker::prepare_finalizers): ...this. (tree_predictive_commoning_loop): Renamed to... (pcom_worker::tree_predictive_commoning_loop): ...this, adjust some calls and remove some cleanup code. (tree_predictive_commoning): Adjusted to use pcom_worker instance. (static variable looparound_phis): Remove. (static variable name_expansions): Remove.
2021-06-24refactor SLP permute propagationRichard Biener1-42/+49
This refactors SLP permute propagation to record the outgoing permute separately from the incoming/materialized one. Instead of separate arrays/bitmaps I've now created a struct to represent the state. 2021-06-23 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (slpg_vertex): New struct. (vect_slp_build_vertices): Adjust. (vect_optimize_slp): Likewise. Maintain an outgoing permute and a materialized one.
2021-06-24tree-optimization/101105 - fix runtime alias test optimizationRichard Biener2-2/+26
We were ignoring DR_STEP for VF == 1 which is OK only in case the scalar order is preserved or both DR steps are the same. 2021-06-23 Richard Biener <rguenther@suse.de> PR tree-optimization/101105 * tree-vect-data-refs.c (vect_prune_runtime_alias_test_list): Only ignore steps when they are equal or scalar order is preserved. * gcc.dg/torture/pr101105.c: New testcase.
2021-06-24i386: Add vashlm3/vashrm3/vlshrm3 to enable vectorization of vector shift ↵liuhongt6-57/+329
vector. [PR98434] Add expanders for vashl<VI12_AVX512BW>, vlshr<VI12_AVX512BW>, vashr<VI1_AVX512BW> and vashr<v32hi,v16hi,v4di,v8di>. Besides there's some assumption in expand_mult_const that mul and add must be available at the same time, but for i386, addv8qi is restricted under TARGET_64BIT, but mulv8qi not, that could cause ICE. So restrict mulv8qi and shiftv8qi under TARGET_64BIT. gcc/ChangeLog: PR target/98434 * config/i386/i386-expand.c (ix86_expand_vec_interleave): Adjust comments for ix86_expand_vecop_qihi2. (ix86_expand_vecmul_qihi): Renamed to .. (ix86_expand_vecop_qihi2): Adjust function prototype to support shift operation, add static to definition. (ix86_expand_vec_shift_qihi_constant): Add static to definition. (ix86_expand_vecop_qihi): Call ix86_expand_vecop_qihi2 and ix86_expand_vec_shift_qihi_constant. * config/i386/i386-protos.h (ix86_expand_vecmul_qihi): Deleted. (ix86_expand_vec_shift_qihi_constant): Deleted. * config/i386/sse.md (VI12_256_512_AVX512VL): New mode iterator. (mulv8qi3): Call ix86_expand_vecop_qihi directly, add condition TARGET_64BIT. (mul<mode>3): Ditto. (<insn><mode>3): Ditto. (vlshr<mode>3): Extend to support avx512 vlshr. (v<insn><mode>3): New expander for vashr/vlshr/vashl. (v<insn>v8qi3): Ditto. (vashrv8hi3<mask_name>): Renamed to .. (vashr<mode>3): And extend to support V16QImode for avx512. (vashrv16qi3): Deleted. (vashrv2di3<mask_name>): Extend expander to support avx512 instruction. gcc/testsuite/ChangeLog: PR target/98434 * gcc.target/i386/pr98434-1.c: New test. * gcc.target/i386/pr98434-2.c: New test. * gcc.target/i386/avx512vl-pr95488-1.c: Adjust testcase.
2021-06-24Daily bump.GCC Administrator5-1/+223
2021-06-23c++: excessive instantiation during CTAD [PR101174]Patrick Palka3-4/+43
We set DECL_CONTEXT on implicitly generated deduction guides so that their access is consistent with that of the constructor. But this apparently leads to excessive instantiation in some cases, ultimately because instantiation of a deduction guide should be independent of instantiation of the resulting class specialization, but setting the DECL_CONTEXT of the former to the latter breaks this independence. To fix this, this patch makes push_access_scope handle artificial deduction guides specifically rather than setting their DECL_CONTEXT in build_deduction_guide. We could alternatively make the class befriend the guide via DECL_BEFRIENDING_CLASSES, but that wouldn't be a complete fix and would break class-deduction-access3.C below since friendship isn't transitive. PR c++/101174 gcc/cp/ChangeLog: * pt.c (push_access_scope): For artificial deduction guides, set the access scope to that of the constructor. (pop_access_scope): Likewise. (build_deduction_guide): Don't set DECL_CONTEXT on the guide. libstdc++-v3/ChangeLog: * testsuite/23_containers/multiset/cons/deduction.cc: Uncomment CTAD example that was rejected by this bug. * testsuite/23_containers/set/cons/deduction.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction-access3.C: New test. * g++.dg/cpp1z/class-deduction91.C: New test.
2021-06-23doc/lto.texi: List slim object format as the defaultDimitar Dimitrov1-13/+12
Slim LTO object files have been the default for quite a while, since: commit e9f67e625c2a4225a7169d7220dcb85b6fdd7ca9 Author: Jan Hubicka <hubicka@gcc.gnu.org> common.opt (ffat-lto-objects): Disable by default. That commit did not update lto.texi, so do it now. gcc/ChangeLog: * doc/lto.texi (Design Overview): Update that slim objects are the default. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-06-23fortran/dump-parse-tree.c: Use proper enum typeTobias Burnus1-1/+1
gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_clauses): Fix enum type used for dumping gfc_omp_defaultmap_category.
2021-06-23Do not enable pcrel-opt by defaultAaron Sawdey16-16/+18
SPEC2017 testing on p10 shows that this optimization does not have a positive impact on performance. So we are no longer going to enable it by default. The test cases for it needed to be updated so they always enable it to test it. gcc/ * config/rs6000/rs6000-cpus.def: Take OPTION_MASK_PCREL_OPT out of OTHER_POWER10_MASKS so it will not be enabled by default. gcc/testsuite/ * gcc.target/powerpc/pcrel-opt-inc-di.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-df.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-di.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-hi.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-qi.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-sf.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-si.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-ld-vector.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-df.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-di.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-hi.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-qi.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-sf.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-si.c: Enable -mpcrel-opt to test it. * gcc.target/powerpc/pcrel-opt-st-vector.c: Enable -mpcrel-opt to test it.
2021-06-23testsuite: add -fwrapv for 950704-1.cXi Ruoyao1-0/+1
gcc/testsuite * gcc.c-torture/execute/950704-1.c: Add -fwrapv to avoid undefined behavior.
2021-06-23tree-inline: Fix TREE_READONLY of parameter replacementsMartin Jambor1-11/+5
tree-inline leaves behind VAR_DECLs which are TREE_READONLY (because they are copies of const parameters) but are written to because they need to be initialized. This patch resets the flag unconditionally so that this does not happen. There are other sources of variables which are incorrectly marked as TREE_READOLY, but with this patch and a verifier catching them I can at least compile the Ada run-time library. gcc/ChangeLog: 2021-06-22 Richard Biener <rguenther@suse.de> Martin Jambor <mjambor@suse.cz> * tree-inline.c (setup_one_parameter): Set TREE_READONLY of the param replacement unconditionally. Adjust comment.
2021-06-23Split gimple-range into gimple-range-fold and gimple-range.Andrew MacLeod7-1519/+1574
Split the fold_using_range functions from gimple-range into gimple-range-fold. Also move the gimple_range_calc* routines into gimple-range-gori. * Makefile.in (OBJS): Add gimple-range-fold.o * gimple-range-fold.cc: New. * gimple-range-fold.h: New. * gimple-range-gori.cc (gimple_range_calc_op1): Move to here. (gimple_range_calc_op2): Ditto. * gimple-range-gori.h: Move prototypes to here. * gimple-range.cc: Adjust include files. (fur_source:fur_source): Relocate to gimple-range-fold.cc. (fur_source::get_operand): Ditto. (fur_source::get_phi_operand): Ditto. (fur_source::query_relation): Ditto. (fur_source::register_relation): Ditto. (class fur_edge): Ditto. (fur_edge::fur_edge): Ditto. (fur_edge::get_operand): Ditto. (fur_edge::get_phi_operand): Ditto. (fur_stmt::fur_stmt): Ditto. (fur_stmt::get_operand): Ditto. (fur_stmt::get_phi_operand): Ditto. (fur_stmt::query_relation): Ditto. (class fur_depend): Relocate to gimple-range-fold.h. (fur_depend::fur_depend): Relocate to gimple-range-fold.cc. (fur_depend::register_relation): Ditto. (fur_depend::register_relation): Ditto. (class fur_list): Ditto. (fur_list::fur_list): Ditto. (fur_list::get_operand): Ditto. (fur_list::get_phi_operand): Ditto. (fold_range): Ditto. (adjust_pointer_diff_expr): Ditto. (gimple_range_adjustment): Ditto. (gimple_range_base_of_assignment): Ditto. (gimple_range_operand1): Ditto. (gimple_range_operand2): Ditto. (gimple_range_calc_op1): Relocate to gimple-range-gori.cc. (gimple_range_calc_op2): Ditto. (fold_using_range::fold_stmt): Relocate to gimple-range-fold.cc. (fold_using_range::range_of_range_op): Ditto. (fold_using_range::range_of_address): Ditto. (fold_using_range::range_of_phi): Ditto. (fold_using_range::range_of_call): Ditto. (fold_using_range::range_of_builtin_ubsan_call): Ditto. (fold_using_range::range_of_builtin_call): Ditto. (fold_using_range::range_of_cond_expr): Ditto. (fold_using_range::range_of_ssa_name_with_loop_info): Ditto. (fold_using_range::relation_fold_and_or): Ditto. (fold_using_range::postfold_gcond_edges): Ditto. * gimple-range.h: Add gimple-range-fold.h to include files. Change GIMPLE_RANGE_STMT_H to GIMPLE_RANGE_H. (gimple_range_handler): Relocate to gimple-range-fold.h. (gimple_range_ssa_p): Ditto. (range_compatible_p): Ditto. (class fur_source): Ditto. (class fur_stmt): Ditto. (class fold_using_range): Ditto. (gimple_range_calc_op1): Relocate to gimple-range-gori.h (gimple_range_calc_op2): Ditto.
2021-06-23Do not continue propagating values which cannot be set properly.Andrew MacLeod2-1/+11
If the on-entry cache cannot properly represent a range, do not continue trying to propagate it. PR tree-optimization/101148 PR tree-optimization/101014 * gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust. (ranger_cache::~ranger_cache): Adjust. (ranger_cache::block_range): Check if propagation disallowed. (ranger_cache::propagate_cache): Disallow propagation if new value can't be stored properly. * gimple-range-cache.h (ranger_cache::m_propfail): New member.
2021-06-23Adjust on_entry cache to indicate if the value was set properly.Andrew MacLeod2-20/+26
* gimple-range-cache.cc (class ssa_block_ranges): Adjust prototype. (sbr_vector::set_bb_range): Return true. (class sbr_sparse_bitmap): Adjust. (sbr_sparse_bitmap::set_bb_range): Return value. (block_range_cache::set_bb_range): Return value. (ranger_cache::propagate_cache): Use return value to print msg. * gimple-range-cache.h (class block_range_cache): Adjust.
2021-06-23Dump should be read only. Do not trigger new lookups.Andrew MacLeod1-1/+1
* gimple-range.cc (dump_bb): Use range_on_edge from the cache.
2021-06-23Use more logicals to eliminate useless test/compare instructionsJeff Law3-95/+55
gcc/ * config/h8300/logical.md (<code><mode>3<ccnz>): Use <cczn> so this pattern can be used for test/compare removal. Pass current insn to compute_logical_op_length and output_logical_op. * config/h8300/h8300.c (compute_logical_op_cc): Remove. (h8300_and_costs): Add argument to compute_logical_op_length. (output_logical_op): Add new argument. Use it to determine if the condition codes are used and adjust the output accordingly. (compute_logical_op_length): Add new argument and update length computations when condition codes are used. * config/h8300/h8300-protos.h (compute_logical_op_length): Update prototype. (output_logical_op): Likewise.
2021-06-23i386: Add PPERM two-operand 64bit vector permutation [PR89021]Uros Bizjak4-15/+75
Add emulation of V8QI PPERM permutations for TARGET_XOP target. Similar to PSHUFB, the permutation is performed with V16QI PPERM instruction, where selector is defined in V16QI mode with inactive elements set to 0x80. Specific to two operand permutations is the remapping of elements from the second operand (e.g. e[8] -> e[16]), as we have to account for the inactive elements from the first operand. 2021-06-23 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/89021 * config/i386/i386-expand.c (expand_vec_perm_pshufb): Handle 64bit modes for TARGET_XOP. Use indirect gen_* functions. * config/i386/mmx.md (mmx_ppermv64): New insn pattern. * config/i386/i386.md (unspec): Move UNSPEC_XOP_PERMUTE from ... * config/i386/sse.md (unspec): ... here.
2021-06-23arm: Revert partially ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3eMartin Liska1-0/+2
PR target/98636 gcc/ChangeLog: * optc-save-gen.awk: Put back arm_fp16_format to checked_options.
2021-06-23c++: CTAD and deduction guide selection [PR86439]Patrick Palka6-28/+100
During CTAD, we select the best viable deduction guide using build_new_function_call, which performs overload resolution on the set of candidate guides and then forms a call to the guide. As the PR points out, this latter step is unnecessary and occasionally incorrect since a call to the selected guide may be ill-formed, or forming the call may have side effects such as prematurely deducing the type of a {}. So this patch introduces a specialized subroutine based on build_new_function_call that stops short of building a call to the selected function, and makes do_class_deduction use this subroutine instead. And since a call is no longer built, do_class_deduction doesn't need to set tf_decltype or cp_unevaluated_operand anymore. This change causes us to reject some container CTAD examples in the libstdc++ testsuite due to deduction failure for {}, which AFAICT is the correct behavior. Previously in e.g. the first removed example std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}}, the type of the {} would get deduced to less<int> as a side effect of forming a call to the chosen guide template<typename _Key, typename _Tp, typename _Compare = less<_Key>, typename _Allocator = allocator<pair<const _Key, _Tp>>> map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator()) -> map<_Key, _Tp, _Compare, _Allocator>; which made later overload resolution for the constructor call unambiguous. Now, the type of the {} remains undeduced until constructor overload resolution, and we complain about ambiguity for the two equally good constructor candidates map(initializer_list<value_type>, const _Compare& = _Compare(), const allocator_type& = allocator_type()) map(initializer_list<value_type>, const allocator_type&). This patch fixes these problematic container CTAD examples by giving the {} an appropriate concrete type. Two of these adjusted CTAD examples (one for std::set and one for std::multiset) end up triggering an unrelated CTAD bug on trunk, PR101174, so these two adjusted examples are commented out for now. PR c++/86439 gcc/cp/ChangeLog: * call.c (print_error_for_call_failure): Constify 'args' parameter. (perform_dguide_overload_resolution): Define. * cp-tree.h: (perform_dguide_overload_resolution): Declare. * pt.c (do_class_deduction): Use perform_dguide_overload_resolution instead of build_new_function_call. Don't use tf_decltype or set cp_unevaluated_operand. Remove unnecessary NULL_TREE tests. libstdc++-v3/ChangeLog: * testsuite/23_containers/map/cons/deduction.cc: Replace ambiguous CTAD examples. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. Mention one of the replaced examples is broken due to PR101174. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Replace ambiguous CTAD examples. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction88.C: New test. * g++.dg/cpp1z/class-deduction89.C: New test. * g++.dg/cpp1z/class-deduction90.C: New test.
2021-06-23i386: Prevent unwanted combine from LZCNT to BSR [PR101175]Uros Bizjak2-21/+43
The current RTX pattern for BSR allows combine pass to convert LZCNT insn to BSR. Note that the LZCNT has a defined behavior to return the operand size when operand is zero, where BSR has not. Add a BSR specific setting of zero-flag to RTX pattern of BSR insn in order to avoid matching unwanted combinations. 2021-06-23 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/101175 * config/i386/i386.md (bsr_rex64): Add zero-flag setting RTX. (bsr): Ditto. (*bsrhi): Remove. (clz<mode>2): Update RTX pattern for additions. gcc/testsuite/ PR target/101175 * gcc.target/i386/pr101175.c: New test.
2021-06-23fortran: Fix deref of optional in gen. code. [PR100337]Andre Vehreschild2-2/+64
gcc/fortran/ChangeLog: PR fortran/100337 * trans-intrinsic.c (conv_co_collective): Check stat for null ptr before dereferrencing. gcc/testsuite/ChangeLog: PR fortran/100337 * gfortran.dg/coarray_collectives_17.f90: New test.
2021-06-23openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]Jakub Jelinek1-1/+3
The following testcase FAILs, because the UDR combiner is invoked incorrectly. lower_omp_rec_clauses expects that when it sets DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P for both the placeholder and the var that everything will be properly regimplified, but as the variable in question is a PARM_DECL rather than VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified and so it is not. 2021-06-23 Jakub Jelinek <jakub@redhat.com> PR middle-end/101167 * omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set. * testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.
2021-06-23Daily bump.GCC Administrator4-1/+289
2021-06-22Fortran: fix sm computation in CFI_allocate [PR93524]Sandra Loosemore2-0/+50
This patch fixes a bug in setting the step multiplier field in the C descriptor for array dimensions > 2. 2021-06-21 Sandra Loosemore <sandra@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> libgfortran/ PR fortran/93524 * runtime/ISO_Fortran_binding.c (CFI_allocate): Fix sm computation. gcc/testsuite/ PR fortran/93524 * gfortran.dg/pr93524.c: New. * gfortran.dg/pr93524.f90: New.
2021-06-22analyzer: fix ICE on malloc/alloca param type mismatch [PR101143]David Malcolm2-4/+33
gcc/analyzer/ChangeLog: PR analyzer/101143 * region-model.cc (compat_types_p): New function. (region_model::create_region_for_heap_alloc): Convert assertion to an error check. (region_model::create_region_for_alloca): Likewise. gcc/testsuite/ChangeLog: PR analyzer/101143 * gcc.dg/analyzer/pr101143.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-06-22docs: drop unbalanced parenthesis in rtl.texiSergei Trofimovich1-1/+1
gcc/ChangeLog: * doc/rtl.texi: drop unbalanced parenthesis.
2021-06-22middle-end/101156 - remove not working optimization in gimplificationRichard Biener2-14/+9
This removes a premature and not working optimization from the gimplifier. When gimplification is requested not to produce a SSA name we try to avoid generating a copy when we did so anyway but instead replace the LHS of its definition. But that only works in case there are no uses of the SSA name already which is something we cannot easily check, so the following removes said optimization. Statistics on the whole bootstrap shows we hit this optimization only for libiberty/cp-demangle.c and overall we have 21652112 gimplifications where just 240 copies are elided. Preserving the optimization would require scanning the original expression and the pre and post sequences for SSA names and uses, that seems excessive to avoid these 240 copies. 2021-06-22 Richard Biener <rguenther@suse.de> PR middle-end/101156 * gimplify.c (gimplify_expr): Remove premature incorrect optimization. * gcc.dg/pr101156.c: New testcase.
2021-06-22testsuite: Add testcase for recently fixed PR [PR101159]Jakub Jelinek2-4/+14
On Tue, Jun 22, 2021 at 11:00:51AM +0200, Richard Biener wrote: > 2021-06-22 Richard Biener <rguenther@suse.de> > > PR tree-optimization/101159 > * tree-vect-patterns.c (vect_recog_popcount_pattern): Add > missing NULL vectype check. The following patch adds the testcase for it, IMHO it can't hurt and from my experience testcases often trigger other bugs later on (rather than the original bugs reappearing, though even that happens), and also fixes a couple of typos in the new function. 2021-06-22 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/101159 * tree-vect-patterns.c (vect_recog_popcount_pattern): Fix some comment typos. * gcc.c-torture/compile/pr101159.c: New test.
2021-06-22expand: Fix up empty class return optimization [PR101160]Jakub Jelinek3-9/+34
On Mon, Jun 14, 2021 at 11:24:22PM -0400, Jason Merrill via Gcc-patches wrote: > The x86_64 psABI says that an empty class isn't passed or returned in memory or > registers, so we shouldn't set %eax in this function. Is this a reasonable > place to implement that? Another possibility would be to remove the hack to > prevent i386.c:function_value_64 from returning NULL in this case and fix the > callers to deal, but that seems like more work. > > The df-scan hunk catches the case where we look at a 0-length reg and build > a range the length of unsigned int, which happened before I changed > assign_parms to match expand_function_end. The assign_params change unfortunately breaks e.g. the following testcase. The problem is that some passes (e.g. subreg lowering but assign_parms comments also talk about delayed slot scheduling) rely on crtl->return_rtx not to contain pseudo registers, and the assign_parms change results in the pseudo in there not being replaced with a hard register. The following patch instead clears the crtl->return_rtx if a function returns TYPE_EMPTY_P structure, that way (use (pseudo)) is not emitted into the IL and it is treated like more like functions returning void. I've also changed the effective target on the empty-class1.C testcase, so that it doesn't fail on x86_64-linux with -m32 testing. 2021-06-22 Jakub Jelinek <jakub@redhat.com> PR middle-end/101160 * function.c (assign_parms): For decl_result with TYPE_EMPTY_P type clear crtl->return_rtx instead of keeping it referencing a pseudo. * g++.target/i386/empty-class1.C: Require lp64 effective target instead of x86_64-*-*. * g++.target/i386/empty-class2.C: New test.
2021-06-22fold-const: Return corresponding integral type for OFFSET_TYPE in ↵Jakub Jelinek2-1/+22
range_check_type [PR101162] Andrew's recent r12-1608-g2f1686ff70b25fceb04ca2ffc0a450fb682913ef change to fail verification on various unary and binary operations with OFFSET_TYPE revealed that e.g. switchconv happily performs multiplications and additions in OFFSET_TYPE. 2021-06-22 Jakub Jelinek <jakub@redhat.com> Andrew Pinski <apinski@marvell.com> PR tree-optimization/101162 * fold-const.c (range_check_type): Handle OFFSET_TYPE like pointer types. * g++.dg/opt/pr101162.C: New test.
2021-06-22Add relational self-tests.Andrew MacLeod1-0/+25
* range-op.cc (range_relational_tests): New. (range_op_tests): Call range_relational_tests.
2021-06-22Add relation between LHS and op1 for casts and copies.Andrew MacLeod1-0/+41
* range-op.cc (operator_cast::lhs_op1_relation): New. (operator_identity::lhs_op1_relation): Mew.
2021-06-22Add relation effects between operands to MINUS_EXPR.Andrew MacLeod1-0/+44
* range-op.cc (operator_minus::op1_op2_relation_effect): New.
2021-06-22Add relations between LHS and op1/op2 for PLUS_EXPR.Andrew MacLeod1-0/+80
* range-op.cc (operator_plus::lhs_op1_relation): New. (operator_plus::lhs_op2_relation): New.
2021-06-22Add relational support to fold_using_rangeAndrew MacLeod3-63/+324
Enable a relation oracle in ranger, and add full range-op relation support to fold_using_range. * gimple-range-cache.cc (ranger_cache::ranger_cache): Create a relation_oracle if dominators exist. (ranger_cache::~ranger_cache): Dispose of oracle. (ranger_cache::dump_bb): Dump oracle. * gimple-range.cc (fur_source::fur_source): New. (fur_source::get_operand): Use mmeber query. (fur_source::get_phi_operand): Use member_query. (fur_source::query_relation): New. (fur_source::register_dependency): Delete. (fur_source::register_relation): New. (fur_edge::fur_edge): Adjust. (fur_edge::get_phi_operand): Fix comment. (fur_edge::query): Delete. (fur_stmt::fur_stmt): Adjust. (fur_stmt::query): Delete. (fur_depend::fur_depend): Adjust. (fur_depend::register_relation): New. (fur_depend::register_relation): New. (fur_list::fur_list): Adjust. (fur_list::get_operand): Use member query. (fold_using_range::range_of_range_op): Process and query relations. (fold_using_range::range_of_address): Adjust dependency call. (fold_using_range::range_of_phi): Ditto. (gimple_ranger::gimple_ranger): New. Use ranger_ache oracle. (fold_using_range::relation_fold_and_or): New. (fold_using_range::postfold_gcond_edges): New. * gimple-range.h (class gimple_ranger): Adjust. (class fur_source): Adjust members. (class fur_stmt): Ditto. (class fold_using_range): Ditto.
2021-06-22Add relational support to range-op.Andrew MacLeod2-139/+469
This patch integrates relations with range-op functionality so that any known relations can be used to help reduce or resolve ranges. Initially handle EQ_EXPR, NE_EXPR, LE_EXPR, LT_EXPR, GT_EXPR and GE_EXPR. * range-op.cc (range_operator::wi_fold): Apply relation effect. (range_operator::fold_range): Adjust and apply relation effect. (*::fold_range): Add relation parameters. (*::op1_range): Ditto. (*::op2_range): Ditto. (range_operator::lhs_op1_relation): New. (range_operator::lhs_op2_relation): New. (range_operator::op1_op2_relation): New. (range_operator::op1_op2_relation_effect): New. (relop_early_resolve): New. (operator_equal::op1_op2_relation): New. (operator_equal::fold_range): Call relop_early_resolve. (operator_not_equal::op1_op2_relation): New. (operator_not_equal::fold_range): Call relop_early_resolve. (operator_lt::op1_op2_relation): New. (operator_lt::fold_range): Call relop_early_resolve. (operator_le::op1_op2_relation): New. (operator_le::fold_range): Call relop_early_resolve. (operator_gt::op1_op2_relation): New. (operator_gt::fold_range): Call relop_early_resolve. (operator_ge::op1_op2_relation): New. (operator_ge::fold_range): Call relop_early_resolve. * range-op.h (class range_operator): Adjust parameters and methods.
2021-06-22Initial value-relation code.Andrew MacLeod7-2/+1155
This code provides a both an equivalence and relation oracle which can be accessed via a range_query object. This initial code drop includes the oracles and access them, but does not utilize them yet. * Makefile.in (OBJS): Add value-relation.o. * gimple-range.h: Adjust include files. * tree-data-ref.c: Adjust include file order. * value-query.cc (range_query::get_value_range): Default to no oracle. (range_query::query_relation): New. (range_query::query_relation): New. * value-query.h (class range_query): Adjust. * value-relation.cc: New. * value-relation.h: New.
2021-06-22tree-optimization/101151 - fix irreducible region check for sinkingRichard Biener2-1/+27
The check whether two blocks are in the same irreducible region and thus post-dominance checks being unreliable was incomplete since an irreducible region can contain reducible sub-regions but if one block is in the irreducible part and one not the check still doesn't work as expected. 2021-06-22 Richard Biener <rguenther@suse.de> PR tree-optimization/101151 * tree-ssa-sink.c (statement_sink_location): Expand irreducible region check. * gcc.dg/torture/pr101151.c: New testcase.