aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-05-28c++: 'this' adjustment for devirtualized callJason Merrill3-4/+55
My patch for 95719 made us do a better job of finding the actual virtual function we want to call, but didn't update the 'this' pointer adjustment to match. PR c++/100797 PR c++/95719 gcc/cp/ChangeLog: * call.c (build_over_call): Adjust base_binfo in resolves_to_fixed_type_p case. gcc/testsuite/ChangeLog: * g++.dg/inherit/virtual15.C: New test.
2021-05-28ipa/100791 - copy fntype when processing __builtin_va_arg_packRichard Biener2-0/+10
This missing copying exposed a type mismatch in the IL. 2021-05-28 Richard Biener <rguenther@suse.de> PR ipa/100791 * tree-inline.c (copy_bb): When processing __builtin_va_arg_pack copy fntype from original call. * gcc.dg/pr100791.c: New testcase.
2021-05-28c/100803 - diagnose invalid GIMPLE conditionRichard Biener2-0/+20
another easy fix for GIMPLE FE parser robustness. 2021-05-28 Richard Biener <rguenther@suse.de> PR c/100803 gcc/c/ * gimple-parser.c (c_parser_gimple_paren_condition): Diagnose invalid if conditions. gcc/testsuite/ * gcc.dg/gimplefe-error-11.c: New testcase.
2021-05-28DOC: Update __gcov_dump documentation.Martin Liska1-2/+1
PR gcov-profile/100751 gcc/ChangeLog: * doc/gcov.texi: Revert partially a hunk that was wrong.
2021-05-28C-SKY: Define HAVE_sync_compare_and_swap*.Cooper Qu1-0/+10
The SYNC operations are implemented as library functions, not NSN patterns. As a result, the HAVE defines for the patterns are not defined. We need to define them to generate the corresponding __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* and __GCC_ATOMIC_*_LOCK_FREE defines. gcc/ * config/csky/csky-linux-elf.h (HAVE_sync_compare_and_swapqi): Defined. (HAVE_sync_compare_and_swaphi): Likewise. (HAVE_sync_compare_and_swapsi): Likewise.
2021-05-28openmp: Fix up handling of reduction clause on constructs combined with ↵Jakub Jelinek8-83/+190
target [PR99928] The reduction clause should be copied as map (tofrom: ) to combined target if present, but as we need different handling of array sections between map and reduction, doing that during gimplification would be harder. So, this patch adds them during splitting, and similarly to firstprivate adds them with a new flag that they should be just ignored/removed if an explicit map clause of the same list item is present. The exact rules are to be decided in https://github.com/OpenMP/spec/issues/2766 so this patch just implements something that is IMHO reasonable and exact detailed testcases for the cornercases will follow once it is clarified. 2021-05-28 Jakub Jelinek <jakub@redhat.com> PR middle-end/99928 gcc/ * tree.h (OMP_CLAUSE_MAP_IMPLICIT): Define. gcc/c-family/ * c-omp.c (c_omp_split_clauses): For reduction clause if combined with target add a map tofrom clause with OMP_CLAUSE_MAP_IMPLICIT. gcc/c/ * c-typeck.c (handle_omp_array_sections): Copy OMP_CLAUSE_MAP_IMPLICIT. (c_finish_omp_clauses): Move not just OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT marked clauses last, but also OMP_CLAUSE_MAP_IMPLICIT. Add map_firstprivate_head bitmap, set it for GOMP_MAP_FIRSTPRIVATE_POINTER maps and silently remove OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT if it is present too. For OMP_CLAUSE_MAP_IMPLICIT silently remove the clause if present in map_head, map_field_head or map_firstprivate_head bitmaps. gcc/cp/ * semantics.c (handle_omp_array_sections): Copy OMP_CLAUSE_MAP_IMPLICIT. (finish_omp_clauses): Move not just OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT marked clauses last, but also OMP_CLAUSE_MAP_IMPLICIT. Add map_firstprivate_head bitmap, set it for GOMP_MAP_FIRSTPRIVATE_POINTER maps and silently remove OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT if it is present too. For OMP_CLAUSE_MAP_IMPLICIT silently remove the clause if present in map_head, map_field_head or map_firstprivate_head bitmaps. gcc/testsuite/ * c-c++-common/gomp/pr99928-8.c: Remove all xfails. * c-c++-common/gomp/pr99928-9.c: Likewise. * c-c++-common/gomp/pr99928-10.c: Likewise. * c-c++-common/gomp/pr99928-16.c: New test.
2021-05-28OpenMP: Add iterator support to Fortran's depend; add affinity clauseTobias Burnus32-143/+1674
gcc/c-family/ChangeLog: * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_AFFINITY. gcc/c/ChangeLog: * c-parser.c (c_parser_omp_clause_affinity): New. (c_parser_omp_clause_name, c_parser_omp_variable_list, c_parser_omp_all_clauses, OMP_TASK_CLAUSE_MASK): Handle affinity clause. * c-typeck.c (handle_omp_array_sections_1, handle_omp_array_sections, c_finish_omp_clauses): Likewise. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_clause_affinity): New. (cp_parser_omp_clause_name, cp_parser_omp_var_list_no_open, cp_parser_omp_all_clauses, OMP_TASK_CLAUSE_MASK): Handle affinity clause. * semantics.c (handle_omp_array_sections_1, handle_omp_array_sections, finish_omp_clauses): Likewise. gcc/fortran/ChangeLog: * dump-parse-tree.c (show_iterator): New. (show_omp_namelist): Handle iterators. (show_omp_clauses): Handle affinity. * gfortran.h (gfc_free_omp_namelist): New union with 'udr' and new 'ns'. * match.c (gfc_free_omp_namelist): Add are to choose union element. * openmp.c (gfc_free_omp_clauses, gfc_match_omp_detach, gfc_match_omp_clause_reduction, gfc_match_omp_flush): Update call to gfc_free_omp_namelist. (gfc_match_omp_variable_list): Likewise; permit preceeding whitespace. (enum omp_mask1): Add OMP_CLAUSE_AFFINITY. (gfc_match_iterator): New. (gfc_match_omp_clauses): Use it; update call to gfc_free_omp_namelist. (OMP_TASK_CLAUSES): Add OMP_CLAUSE_AFFINITY. (gfc_match_omp_taskwait): Match depend clause. (resolve_omp_clauses): Handle affinity; update for udr/union change. (gfc_resolve_omp_directive): Resolve clauses of taskwait. * st.c (gfc_free_statement): Update gfc_free_omp_namelist call. * trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Likewise (handle_iterator): New. (gfc_trans_omp_clauses): Handle iterators for depend/affinity clause. (gfc_trans_omp_taskwait): Handle depend clause. (gfc_trans_omp_directive): Update call. gcc/ChangeLog: * gimplify.c (gimplify_omp_affinity): New. (gimplify_scan_omp_clauses): Call it; remove affinity clause afterwards. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_AFFINITY. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_AFFINITY. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add clause. (walk_tree_1): Handle OMP_CLAUSE_AFFINITY. libgomp/ChangeLog: * testsuite/libgomp.fortran/depend-iterator-2.f90: New test. gcc/testsuite/ChangeLog: * c-c++-common/gomp/affinity-1.c: New test. * c-c++-common/gomp/affinity-2.c: New test. * c-c++-common/gomp/affinity-3.c: New test. * c-c++-common/gomp/affinity-4.c: New test. * c-c++-common/gomp/affinity-5.c: New test. * c-c++-common/gomp/affinity-6.c: New test. * c-c++-common/gomp/affinity-7.c: New test. * gfortran.dg/gomp/affinity-clause-1.f90: New test. * gfortran.dg/gomp/affinity-clause-2.f90: New test. * gfortran.dg/gomp/affinity-clause-3.f90: New test. * gfortran.dg/gomp/affinity-clause-4.f90: New test. * gfortran.dg/gomp/affinity-clause-5.f90: New test. * gfortran.dg/gomp/affinity-clause-6.f90: New test. * gfortran.dg/gomp/depend-iterator-1.f90: New test. * gfortran.dg/gomp/depend-iterator-2.f90: New test. * gfortran.dg/gomp/depend-iterator-3.f90: New test. * gfortran.dg/gomp/taskwait.f90: New test.
2021-05-28Recognize popcount also when a double width operation is needed.Joern Rennecke4-9/+33
2021-05-28 Joern Rennecke <joern.rennecke@riscy-ip.com> gcc/ * match.pd <popcount & / + pattern matching>: When generating popcount directly fails, try doing it in two halves. gcc/testsuite/ * gcc.dg/tree-ssa/popcount4ll.c: Remove lp64 condition. Adjust scanning pattern for !lp64. * gcc.dg/tree-ssa/popcount5ll.c: Likewise. * gcc.dg/tree-ssa/popcount4l.c: Adjust scanning pattern for ! int32plus. Co-Authored-By: Richard Biener <rguenther@suse.de>
2021-05-28Generate gimple-match.c and generic-match.c earlierBernd Edlinger1-0/+1
I was wondering, why gimple-match.c and generic-match.c are not built early but always last, which slows down parallel makes significantly. The reason seems to be that generated_files does not mention gimple-match.c and generic-match.c. This comment in Makefile.in says it all: "In order for parallel make to really start compiling the expensive objects from $(OBJS) as early as possible, build all their prerequisites strictly before all objects." So this patch adds gimple-match.c and generic-match.c to generated_files. 2021-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de> * Makefile.in (generated_files): Add gimple-match.c and generic-match.c
2021-05-28Fix match_dup bug of define_cond_exec.Joern Rennecke1-0/+1
2021-05-28 Joern Rennecke <joern.rennecke@embecosm.com> gcc/ * gensupport.c (alter_predicate_for_insn): Handle MATCH_DUP.
2021-05-28Fix bug in the define_subst handling that made match_scratch unusable for ↵Joern Rennecke1-0/+3
multi-alternative patterns. 2021-05-28 Joern Rennecke <joern.rennecke@embecosm.com> gcc/ * gensupport.c (alter_constraints): Add MATCH_SCRATCH case.
2021-05-28forwprop: Enhance vec perm fed by CTOR and CTOR/CST [PR99398]Kewen Lin6-15/+482
VEC_PERM_EXPR requires the number of MASK elements must be the same with the number of elements in operands V0 and V1. In some cases, like with Power altivec built-in function vec_perm, VIEW_CONVERT_EXPR has to be used to guarantee this requirement, but it can prevent some simplifications which don't consider this well. For the cases that the permutated operands of vector permutation are from two same type CTOR and CTOR, or one CTOR and one VECTOR CST, this patch is to enhance forwprop to look through intermediate VIEW_CONVERT_EXPR and further simplify them if possible. Bootstrapped/regtested on powerpc64le-linux-gnu P9, powerpc64-linux-gnu P8, x86_64-redhat-linux and aarch64-linux-gnu. gcc/ChangeLog: PR tree-optimization/99398 * tree-ssa-forwprop.c (simplify_permutation): Optimize some cases where the fed operands are CTOR/CST and propagated through VIEW_CONVERT_EXPR. Call vec_perm_indices::new_shrunk_vector. * vec-perm-indices.c (vec_perm_indices::new_shrunk_vector): New function. * vec-perm-indices.h (vec_perm_indices::new_shrunk_vector): New declare. gcc/testsuite/ChangeLog: PR tree-optimization/99398 * gcc.target/powerpc/vec-perm-ctor-run.c: New test. * gcc.target/powerpc/vec-perm-ctor.c: New test. * gcc.target/powerpc/vec-perm-ctor.h: New test.
2021-05-28Daily bump.GCC Administrator6-1/+230
2021-05-27gccgo.texi: remove HTML quotingIan Lance Taylor1-1/+1
* gccgo.texi (Function Names): Don't HTML quote ampersand.
2021-05-27c++: Output less irrelevant info for function template decl [PR100716]Matthias Kretz3-15/+156
Ensure dump_template_decl for function templates never prints template parameters after the function name (it did with -fno-pretty-templates) and skip output of irrelevant & confusing "[with T = T]" in dump_substitution. gcc/cp/ChangeLog: PR c++/100716 * error.c (dump_template_bindings): Include code to print "[with" and ']', conditional on whether anything is printed at all. This is tied to whether a semicolon is needed to separate multiple template parameters. If the template argument repeats the template parameter (T = T), then skip the parameter. (dump_substitution): Moved code to print "[with" and ']' to dump_template_bindings. (dump_function_decl): Partial revert of PR50828, which masked TFF_TEMPLATE_NAME for all of dump_function_decl. Now TFF_TEMPLATE_NAME is masked for the scope of the function and only carries through to dump_function_name. (dump_function_name): Avoid calling dump_template_parms if TFF_TEMPLATE_NAME is set. gcc/testsuite/ChangeLog: PR c++/100716 * g++.dg/diagnostic/pr100716.C: New test. * g++.dg/diagnostic/pr100716-1.C: Same test with -fno-pretty-templates.
2021-05-27c++: Add missing scope in typedef diagnostic [PR100763]Matthias Kretz1-0/+2
dump_type on 'const std::string' should not print 'const string' unless TFF_UNQUALIFIED_NAME is requested. gcc/cp/ChangeLog: PR c++/100763 * error.c: Call dump_scope when printing a typedef.
2021-05-27i386: Remove unneeded binary operand fixup from expanders.Uros Bizjak2-160/+56
There is no need to call ix86_fixup_binary_operands when there are only one or no memory operands allowed. 2021-05-27 Uroš Bizjak <ubizjak@gmail.com> gcc/ * config/i386/mmx.md (addv2sf3): Do not call ix86_fixup_binary_operands_no_copy. (subv2sf3): Ditto. (mulv2sf3): Ditto. (<smaxmin:code>v2sf3): Ditto. (<plusminus:insn><MMXMODEI:mode>3): Ditto. (<plusminus:insn><VI_32:mode>3): Remove expander. (<plusminus:insn><VI_32:mode>3): Rename from "*<plusminus:insn><VI_32:mode>3". (mulv4hi): Do not call ix86_fixup_binary_operands_no_copy. (mulv2hi3): Remove expander. (mulv2hi3): Rename from *mulv2hi3. (<s>mulv2hi3_highpart): Remove expander. (<s>mulv2hi3_highpart): Rename from *<s>mulv2hi3_highpart. (<smaxmin:code><MMXMODE14:mode>3): Rename from "*mmx_<smaxmin:code><MMXMODE14:mode>3". (<smaxmin:code><SMAXMIN_MMXMODEI:mode>3): Remove expander. (SMAXMIN_MMXMODEI): Remove mode iterator. (<smaxmin:code>v4hi3): New expander. (<smaxmin:code>v4qi3): Rename from *<smaxmin:code>v4qi3. (<smaxmin:code>v2hi3): Rename from *<smaxmin:code>v2hi3. (<smaxmin:code><SMAXMIN_VI_32:mode>3): Remove expander. (SMAXMIN_VI_32): Remove mode iterator. (<umaxmin:code><MMXMODE24:mode>3): Rename from "*mmx_<umaxmin:code><MMXMODE24:mode>3". (<umaxmin:code><UMAXMIN_MMXMODEI:mode>3): Remove expander. (UMAXMIN_MMXMODEI): Remove mode iterator. (<umaxmin:code>v8qi3): New expander. (<umaxmin:code>v4qi3): Rename from *<umaxmin:code>v4qi3. (<umaxmin:code>v2hi3): Rename from *<umaxmin:code>v2hi3. (<umaxmin:code><SMAXMIN_VI_32:mode>3): Remove expander. (UMAXMIN_VI_32): Remove mode iterator. (<any_shift:insn>v2hi3): Remove expander. (<any_shift:insn>v2hi3): Rename from *<any_shift:insn>v2hi3. (<any_logic:code><MMXMODEI:mode>3): Do not call ix86_fixup_binary_operands_no_copy. (<any_logic:code><VI_32:mode>3): Remove expander. (<any_logic:code><VI_32:mode>3): Rename from "*<any_logic:code><VI_32:mode>3". (uavg<mode>3_ceil): Do not call ix86_fixup_binary_operands_no_copy. * config/i386/sse.md (div<VF2:mode>3): Do not call ix86_fixup_binary_operands_no_copy. (div<VF1:mode>3): Ditto. (<maxmin:code><VI8_AVX2_AVX512F:mode>3): Ditto. (smulhrsv4hi3): Ditto. (smulhrsv2hi3): Ditto.
2021-05-27PR other/100463 - many errors using GTY and hash_mapMartin Sebor2-31/+50
gcc/ChangeLog: * ggc.h (gt_ggc_mx): Add overloads for all integers. (gt_pch_nx): Same. * hash-map.h (class hash_map): Add pch_nx_helper overloads for all integers. (hash_map::operator==): New function.
2021-05-27c++: parameter pack inside static_assert [PR99893]Patrick Palka2-0/+14
Here, we're not finding the parameter pack inside the static_assert because STATIC_ASSERT trees are tcc_exceptional, and we weren't explicitly walking them in cp_walk_subtrees. PR c++/99893 gcc/cp/ChangeLog: * tree.c (cp_walk_subtrees) <case STATIC_ASSERT>: New case. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/static_assert17.C: New test.
2021-05-27c++: argument pack with expansion [PR86355]Jason Merrill2-2/+18
This testcase revealed that we were using PACK_EXPANSION_EXTRA_ARGS a lot more than necessary; use_pack_expansion_extra_args_p meant to use it in the case of corresponding arguments in different argument packs differing in whether they are pack expansions, but it was mistakenly also returning true for the case of a single argument pack containing both expansion and non-expansion elements. Surprisingly, just disabling that didn't lead to any regressions in the testsuite; it seems other changes have prevented us getting to this point for code that used to exercise it. So this patch limits the check to arguments in the same position in the packs, and asserts that we never actually see a mismatch. PR c++/86355 gcc/cp/ChangeLog: * pt.c (use_pack_expansion_extra_args_p): Don't compare args from the same argument pack. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-variadic2.C: New test.
2021-05-27c++: Relax rule for non-type arguments in partial specs [CWG1315]Patrick Palka10-71/+114
This implements the wording changes of CWG 1315, which permits non-type template arguments in a partial specialization to use template parameters more freely. Delightfully, it seems the only change needed is to remove a single check from process_partial_specialization (amidst a bunch of whitespace changes). But that change alone revealed a latent problem with for_each_template_parm: it ends up looking into some non-deduced contexts even when include_nondeduced_p is false. This causes us to silently accept some partial specializations within the testsuite that contain non-deducible non-type template parameters (and that were previously rejected due to the rule that CWG 1315 relaxed). For now this patch makes a minimal amount of changes to for_each_template_parm_r so that we continue to reject existing ill-formed partial specializations within the testsuite. I opened PR c++/100779 to track this issue. DR 1315 PR c++/67593 PR c++/96555 gcc/cp/ChangeLog: * pt.c (process_partial_specialization): Don't error on a non-simple non-type template argument that involves template parameters. (for_each_template_parm_r): Don't walk TRAIT_EXPR, PLUS_EXPR, MULT_EXPR, or SCOPE_REF when include_nondeduced_p is false. gcc/testsuite/ChangeLog: * g++.dg/template/partial16.C: New test. * g++.dg/template/partial17.C: New test. * g++.dg/template/partial18.C: New test. * g++.dg/template/partial19.C: New test. * g++.dg/cpp0x/pr68724.C: Adjust expected diagnostic for ill-formed partial specialization. * g++.dg/cpp0x/variadic38.C: Likewise. * g++.dg/cpp1z/pr81016.C: Likewise. * g++.dg/template/partial5.C: Likewise. * g++.old-deja/g++.pt/spec21.C: Likewise.
2021-05-27i386: Add XOP comparisons for 4- and 8-byte vectors [PR100637]Uros Bizjak2-2/+58
2021-05-27 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/100637 * config/i386/i386-expand.c (ix86_expand_int_sse_cmp): For TARGET_XOP bypass SSE comparisons for all supported vector modes. * config/i386/mmx.md (*xop_maskcmp<MMXMODEI:mode>3): New insn pattern. (*xop_maskcmp<VI_32:mode>3): Ditto. (*xop_maskcmp_uns<MMXMODEI:mode>3): Ditto. (*xop_maskcmp_uns<VI_32:mode>3): Ditto.
2021-05-27Fortran: Fix erroneous "pointer argument is not associated" runtime errorHarald Anlauf2-1/+36
For CLASS arrays we need to use the CLASS data attributes to determine which runtime check to generate. gcc/fortran/ChangeLog: PR fortran/100602 * trans-intrinsic.c (gfc_conv_intrinsic_size): Use CLASS data attributes for CLASS arrays for generation of runtime error. gcc/testsuite/ChangeLog: PR fortran/100602 * gfortran.dg/pointer_check_14.f90: New test.
2021-05-27PR fortran/100656 - prevent ICE in gfc_conv_expr_presentHarald Anlauf2-2/+15
gcc/fortran/ChangeLog: PR fortran/100656 * trans-array.c (gfc_conv_ss_startstride): Do not call check for presence of a dummy argument when a symbol actually refers to a non-dummy. gcc/testsuite/ChangeLog: PR fortran/100656 * gfortran.dg/bounds_check_22.f90: New test.
2021-05-27arm: Remove use of opts_set in arm_configure_build_target [PR100767]Richard Earnshaw3-17/+12
The variable global_options_set is a reflection of which options have been explicitly set from the command line in the structure global_options. But it doesn't describe the contents of a cl_target_option. cl_target_option is a set of options to apply and once configured should represent a viable set of options without needing to know which were explicitly set by the user. Unfortunately arm_configure_build_target was incorrectly conflating the two. Fortunately, however, we do not really need to know this since the various override_options functions should have sanitized the target_options values before constructing a cl_target_option structure. It is safe, therefore, to simply drop this parameter to arm_configure_build_target and rely on checking that various string parameters are non-null before dereferencing them. gcc: PR target/100767 * config/arm/arm.c (arm_configure_build_target): Remove parameter opts_set, directly check opts parameters for being non-null. (arm_option_restore): Update call to arm_configure_build_target. (arm_option_override): Likewise. (arm_can_inline_p): Likewise. (arm_valid_target_attribute_tree): Likewise. * config/arm/arm-c.c (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (arm_configure_build_target): Adjust prototype.
2021-05-27Use get_range_query in simplify_conversion_using_ranges.Aldy Hernandez1-1/+1
Before the fix to the ranger dependency chain yesterday (commit 7f0cfeb1) I thought an ICE I was seeing was due to my get_range_query patchet. This was not the case, but this small change crept in while I was debugging the failure. I'm reverting the change as was approved. Tested on x86-64 Linux. gcc/ChangeLog: * vr-values.c (simplify_conversion_using_ranges): Use get_range_query instead of get_global_range_query.
2021-05-27Move global range code to value-query.cc.Aldy Hernandez6-161/+158
This patch moves all the global range code from gimple-range.cc into value-query.cc. It also moves get_range_info and get_ptr_nonnull from tree-ssanames.c into their only uses, and removes external access to them. gcc/ChangeLog: * gimple-range.cc (get_range_global): Move to value-query.cc. (gimple_range_global): Same. (get_global_range_query): Same. (global_range_query::range_of_expr): Same. * gimple-range.h (class global_range_query): Move to value-query.h. (gimple_range_global): Same. * tree-ssanames.c (get_range_info): Move to value-query.cc. (get_ptr_nonnull): Same. * tree-ssanames.h (get_range_info): Remove. (get_ptr_nonnull): Remove. * value-query.cc (get_ssa_name_range_info): Move from tree-ssanames.c. (get_ssa_name_ptr_info_nonnull): Same. (get_range_global): Move from gimple-range.cc. (gimple_range_global): Same. (get_global_range_query): Same. (global_range_query::range_of_expr): Same. * value-query.h (class global_range_query): Move from gimple-range.h. (gimple_range_global): Same.
2021-05-27Tweak Wstringop-overflow-55.c test.Aldy Hernandez1-1/+1
On x86-32 warn_ptrdiff_anti_range_add() and warn_int_anti_range() degrade to the same function so ICF is folding the latter into a call into the former. This is causing no warnings to be emitted for warn_int_anti_range. Fixed by passing -fno-ipa-icf. gcc/testsuite/ChangeLog: * gcc.dg/Wstringop-overflow-55.c: Pass -fno-ipa-icf.
2021-05-27i386: Add uavg_ceil patterns for 4-byte vectors [PR100637]Uros Bizjak3-0/+61
2021-05-27 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/100637 * config/i386/mmx.md (uavgv4qi3_ceil): New insn pattern. (uavgv2hi3_ceil): Ditto. gcc/testsuite/ PR target/100637 * gcc.target/i386/pr100637-3b.c (avgu): New test. * gcc.target/i386/pr100637-3w.c (avgu): Ditto.
2021-05-27Daily bump.GCC Administrator6-1/+304
2021-05-27Small tweak to documentation of scalar_storage_orderEric Botcazou1-2/+3
gcc/ PR c/100653 * doc/extend.texi (scalar_storage_order): Rephrase slightly.
2021-05-26c++: access for hidden friend of nested class template [PR100502]Patrick Palka3-0/+42
Here, during ahead of time access checking for the private member EnumeratorRange<T>::end_reached_ in the hidden friend f, we're triggering the assert in enforce_access that verifies we're not trying to add a access check for a dependent decl onto TI_DEFERRED_ACCESS_CHECKS. The special thing about this class member access expression is that the overall expression is non-dependent (so finish_class_member_access_expr doesn't exit early at parse time), and then accessible_p rejects the access (so we don't exit early from enforce access either, and end up triggering the assert b/c the member itself is dependent). I think we're correct to reject the access because a hidden friend is not a member function, so [class.access.nest] doesn't apply, and also a hidden friend of a nested class is not a friend of the enclosing class. To fix this ICE, this patch disables ahead of time access checking during the member lookup in finish_class_member_access_expr. This avoids potentially pushing an access check for a dependent member onto TI_DEFERRED_ACCESS_CHECKS, and it's safe because we're going to redo the same lookup at instantiation time anyway. PR c++/100502 gcc/cp/ChangeLog: * typeck.c (finish_class_member_access_expr): Disable ahead of time access checking during the member lookup. gcc/testsuite/ChangeLog: * g++.dg/template/access37.C: New test. * g++.dg/template/access37a.C: New test.
2021-05-26Cleanup get_range_infoAldy Hernandez2-45/+14
Now that there is only one user of get_range_info() we can clean this up to always return a range instead of pairs of wide_ints. A follow-up patch will inline both get_range_info and get_ptr_nonnull into its only remaining user. gcc/ChangeLog: * tree-ssanames.c (get_range_info): Merge both copies of get_range_info into one that works with irange. * tree-ssanames.h (get_range_info): Remove version that works on wide_ints.
2021-05-26Convert remaining passes to get_range_query.Aldy Hernandez26-159/+332
This patch converts the remaining users of get_range_info and get_ptr_nonnull to the get_range_query API. No effort was made to move passes away from VR_ANTI_RANGE, or any other use of deprecated methods. This was a straight up conversion to the new API, nothing else. gcc/ChangeLog: * builtins.c (check_nul_terminated_array): Convert to get_range_query. (expand_builtin_strnlen): Same. (determine_block_size): Same. * fold-const.c (expr_not_equal_to): Same. * gimple-fold.c (size_must_be_zero_p): Same. * gimple-match-head.c: Include gimple-range.h. * gimple-pretty-print.c (dump_ssaname_info): Convert to get_range_query. * gimple-ssa-warn-restrict.c (builtin_memref::extend_offset_range): Same. * graphite-sese-to-poly.c (add_param_constraints): Same. * internal-fn.c (get_min_precision): Same. * ipa-fnsummary.c (set_switch_stmt_execution_predicate): Same. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Same. * match.pd: Same. * tree-data-ref.c (split_constant_offset): Same. (dr_step_indicator): Same. * tree-dfa.c (get_ref_base_and_extent): Same. * tree-scalar-evolution.c (iv_can_overflow_p): Same. * tree-ssa-loop-niter.c (refine_value_range_using_guard): Same. (determine_value_range): Same. (record_nonwrapping_iv): Same. (infer_loop_bounds_from_signedness): Same. (scev_var_range_cant_overflow): Same. * tree-ssa-phiopt.c (two_value_replacement): Same. * tree-ssa-pre.c (insert_into_preds_of_block): Same. * tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Same. * tree-ssa-strlen.c (handle_builtin_stxncpy_strncat): Same. (get_range): Same. (dump_strlen_info): Same. (set_strlen_range): Same. (maybe_diag_stxncpy_trunc): Same. (get_len_or_size): Same. (handle_integral_assign): Same. * tree-ssa-structalias.c (find_what_p_points_to): Same. * tree-ssa-uninit.c (find_var_cmp_const): Same. * tree-switch-conversion.c (bit_test_cluster::emit): Same. * tree-vect-patterns.c (vect_get_range_info): Same. (vect_recog_divmod_pattern): Same. * tree-vrp.c (intersect_range_with_nonzero_bits): Same. (register_edge_assert_for_2): Same. (determine_value_range_1): Same. * tree.c (get_range_pos_neg): Same. * vr-values.c (vr_values::get_lattice_entry): Same. (vr_values::update_value_range): Same. (simplify_conversion_using_ranges): Same.
2021-05-26Convert Walloca pass to get_range_query.Aldy Hernandez3-11/+11
This patch converts the Walloca pass to use an on-demand ranger accesible with get_range_query instead of having to create a ranger and pass it around. gcc/ChangeLog: * gimple-ssa-warn-alloca.c (alloca_call_type): Use get_range_query instead of query argument. (pass_walloca::execute): Enable and disable global ranger. gcc/testsuite/ChangeLog: * gcc.dg/Wstringop-overflow-55.c: Adapt for range query changes. * gcc.dg/pr80776-1.c: Same.
2021-05-26Convert evrp pass to get_range_query.Aldy Hernandez1-11/+9
gcc/ChangeLog: * gimple-ssa-evrp.c (rvrp_folder::rvrp_folder): Call enable_ranger. (rvrp_folder::~rvrp_folder): Call disable_ranger. (hybrid_folder::hybrid_folder): Call enable_ranger. (hybrid_folder::~hybrid_folder): Call disable_ranger.
2021-05-26Common API for accessing global and on-demand ranges.Aldy Hernandez11-50/+172
This patch provides a generic API for accessing global ranges. It is meant to replace get_range_info() and get_ptr_nonnull() with one common interface. It uses the same API as the ranger (class range_query), so there will now be one API for accessing local and global ranges alike. Follow-up patches will convert all users of get_range_info and get_ptr_nonnull to this API. For get_range_info, instead of: if (!POINTER_TYPE_P (TREE_TYPE (name)) && SSA_NAME_RANGE_INFO (name)) get_range_info (name, vr); You can now do: get_range_query (cfun)->range_of_expr (vr, name, [stmt]); ...as well as any other of the range_query methods (range_on_edge, range_of_stmt, value_of_expr, value_on_edge, value_on_stmt, etc). As per the API, range_of_expr will work on constants, SSA names, and anything we support in irange::supports_type_p(). For pointers, the interface is the same, so instead of: else if (POINTER_TYPE_P (TREE_TYPE (name)) && SSA_NAME_PTR_INFO (name)) { if (get_ptr_nonnull (name)) stuff(); } One can do: get_range_query (cfun)->range_of_expr (vr, name, [stmt]); if (vr.nonzero_p ()) stuff (); Along with this interface, we are providing a mechanism by which a pass can use an on-demand ranger transparently, without having to change its code. Of course, this assumes all get_range_info() and get_ptr_nonnull() users have been converted to the new API, which follow-up patches will do. If a pass would prefer to use an on-demand ranger with finer grained and context aware ranges, all it would have to do is call enable_ranger() at the beginning of the pass, and disable_ranger() at the end of the pass. Note, that to use context aware ranges, any user of range_of_expr() would need to pass additional context. For example, the optional gimple statement (or perhaps use range_on_edge or range_of_stmt). The observant reader will note that get_range_query is tied to a struct function, which may not be available in certain contexts, such as at RTL time, gimple-fold, or some other places where we may or may not have cfun set. For cases where we are sure there is no function, you can use get_global_range_query() instead of get_range_query(fun). The API is the same. For cases where a function may be called with or without a function, you could use the following idiom: range_query *query = cfun ? get_range_query (cfun) : get_global_range_query (); query->range_of_expr (range, expr, [stmt]); The default range query obtained by get_range_query() is the global range query, unless the user has enabled an on-demand ranger with enable_ranger(), in which case it will use the currently active ranger. That is, until disable_ranger() is called, at which point, we revert back to global ranges. We think this provides a generic way of accessing ranges, both globally and locally, without having to keep track of types, SSA_NAME_RANGE_INFO, and SSA_NAME_PTR_INFO. We also hope this can be used to transition passes from global to on-demand ranges when appropriate. gcc/ChangeLog: * function.c (allocate_struct_function): Set cfun->x_range_query. * function.h (struct function): Declare x_range_query. (get_range_query): New. (get_global_range_query): New. * gimple-range-cache.cc (ssa_global_cache::ssa_global_cache): Remove call to safe_grow_cleared. * gimple-range.cc (get_range_global): New. (gimple_range_global): Move from gimple-range.h. (get_global_range_query): New. (global_range_query::range_of_expr): New. (enable_ranger): New. (disable_ranger): New. * gimple-range.h (gimple_range_global): Move to gimple-range.cc. (class global_range_query): New. (enable_ranger): New. (disable_ranger): New. * gimple-ssa-evrp.c (evrp_folder::~evrp_folder): Rename dump_all_value_ranges to dump. * tree-vrp.c (vrp_prop::finalize): Same. * value-query.cc (range_query::dump): New. * value-query.h (range_query::dump): New. * vr-values.c (vr_values::dump_all_value_ranges): Rename to... (vr_values::dump): ...this. * vr-values.h (class vr_values): Rename dump_all_value_ranges to dump and make virtual.
2021-05-26i386: Autovectorize 4-byte vectorsUros Bizjak10-9/+205
2021-05-26 Uroš Bizjak <ubizjak@gmail.com> gcc/ * config/i386/i386.c (ix86_autovectorize_vector_modes): Add V4QImode and V16QImode for TARGET_SSE2. * doc/sourcebuild.texi (Vector-specific attributes): Add vect64 and vect32 description. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_vect32): New. (available_vector_sizes): Append 32 for x86 targets. * gcc.dg/vect/pr71264.c (dg-final): Xfail scan dump for vect32 targets. * gcc.dg/vect/slp-28.c (dg-final): Adjust dumps for vect32 targets. * gcc.dg/vect/slp-3.c (dg-final): Ditto. * gcc.target/i386/pr100637-3b.c: New test. * gcc.target/i386/pr100637-3w.c: Ditto. * gcc.target/i386/pr100637-4b.c: Ditto. * gcc.target/i386/pr100637-4w.c: Ditto.
2021-05-26Fix gcc-bootstrap issueBernd Edlinger1-0/+2
... or at least try to. 2021-05-26 Bernd Edlinger <bernd.edlinger@hotmail.de> * gimple-range-gori.cc (range_def_chain::register_dependency): Resize m_def_chain when needed.
2021-05-26Warn on type punning that toggles scalar storage orderEric Botcazou2-0/+31
As documented in the manual, we do not support type punning that toggles the scalar storage order, so this adds a warning for the case of unions. gcc/c/ PR c/100653 * c-decl.c (finish_struct): Warn for a union containing an aggregate field with a differing scalar storage order. gcc/testsuite/ * gcc.dg/sso-13.c: New test.
2021-05-26arm: Auto-vectorization for MVE: vaddvChristophe Lyon4-14/+53
This patch adds support for the reduc_plus_scal optab with MVE, which maps to the vaddv instruction. It moves the reduc_plus_scal_<mode> expander from neon.md to vec-common.md and adds support for MVE to it. Since vaddv uses a 32-bits accumulator, we have to truncate it's result. For instance: int32_t test__s8x16 (int8_t *a) { int i; int8_t result = 0; for (i=0; i<16; i++) { result += a[i]; } return result; } is compiled into: vldrb.8 q3, [r0] vaddv.s8 r0, q3 sxtb r0, r0 bx lr If we used uint8_t instead of int8_t, we still use vaddv.s8 r0, q3, but truncate with uxtb r0, r0. 2021-05-25 Christophe Lyon <christophe.lyon@linaro.org> gcc/ * config/arm/mve.md (mve_vaddvq_<supf><mode>): Prefix with '@'. * config/arm/neon.md (reduc_plus_scal_<mode>): Move to .. * config/arm/vec-common.md: .. here. Add support for MVE. gcc/testsuite/ * gcc.target/arm/simd/mve-vaddv-1.c: New test.
2021-05-26Remove useless register keywordsJakub Jelinek7-30/+32
This patch removes useless register keywords from several backends and one spot in the Ada FE. 2021-05-26 Jakub Jelinek <jakub@redhat.com> gcc/ * config/epiphany/epiphany.c (epiphany_print_operand_address): Remove register keywords. * config/microblaze/microblaze.c (microblaze_legitimize_address, call_internal1, microblaze_option_override, print_operand): Likewise. * config/microblaze/microblaze.md (call_internal_plt, call_value_intern_plt, call_value_intern): Likewise. * config/arm/aout.h (ASM_OUTPUT_ALIGN): Likewise. * config/iq2000/iq2000.md (call_internal1, call_value_internal1, call_value_multiple_internal1): Likewise. * config/bfin/bfin.c (symbolic_reference_mentioned_p): Likewise. gcc/ada/ * init.c (__gnat_error_handler): Remove register keyword.
2021-05-26arc: Remove useless register keywordJan-Benedict Glaw1-10/+10
The "register" keyword was removed in C++17, remove them to get the backend to build again. gcc/ * config/arc/arc.c (arc_address_cost, arc_print_operand_address, arc_ccfsm_advance, symbolic_reference_mentioned_p, arc_raw_symbolic_reference_mentioned_p): Remove register keyword.
2021-05-26c++: constexpr and copy elision within mem init [PR100368]Patrick Palka2-7/+24
In the testcase below, the member initializer b(f()) inside C's default constructor is encoded as a TARGET_EXPR wrapping the CALL_EXPR f() in C++17 mode. During massaging of this constexpr constructor, build_target_expr_with_type called from bot_manip on this initializer tries to add an extra copy using B's implicitly deleted copy constructor rather than just preserving the copy elision. Since it's wrong to introduce an extra copy when initializing a temporary from a CALL_EXPR, this patch makes build_target_expr_with_type avoid calling force_rvalue in this case. Additionally, bot_manip should be copying TARGET_EXPRs in a more oblivious manner, so this patch makes bot_manip use force_target_expr instead of build_target_expr_with_type. And since bot_manip is now no longer a caller, we can remove the void initializer handling in build_target_expr_with_type. PR c++/100368 gcc/cp/ChangeLog: * tree.c (build_target_expr_with_type): Don't call force_rvalue on CALL_EXPR initializer. Simplify now that bot_manip is no longer a caller. (bot_manip): Use force_target_expr instead of build_target_expr_with_type. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/elide6.C: New test.
2021-05-26c++: Fix reference NTTP binding to noexcept fn [PR97420]Patrick Palka3-26/+23
Here, in C++17 mode, convert_nontype_argument_function is rejecting binding a non-noexcept function reference template parameter to a noexcept function (encoded as the template argument '*(int (&) (int)) &f'). The first roadblock to making this work is that the argument is wrapped an an implicit INDIRECT_REF, so we need to unwrap it before calling strip_fnptr_conv. The second roadblock is that the NOP_EXPR cast converts from a function pointer type to a reference type while simultaneously removing the noexcept qualification, and fnptr_conv_p doesn't consider this cast to be a function pointer conversion. This patch fixes this by making fnptr_conv_p treat REFERENCE_TYPEs and POINTER_TYPEs interchangeably. Finally, in passing, this patch also simplifies noexcept_conv_p by removing a bunch of redundant checks already performed by its only caller fnptr_conv_p. PR c++/97420 gcc/cp/ChangeLog: * cvt.c (noexcept_conv_p): Remove redundant checks and simplify. (fnptr_conv_p): Don't call non_reference. Use INDIRECT_TYPE_P instead of TYPE_PTR_P. * pt.c (convert_nontype_argument_function): Look through implicit INDIRECT_REFs before calling strip_fnptr_conv. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/noexcept68.C: New test.
2021-05-26openmp: Fix up handling of target constructs in offloaded routines [PR100573]Jakub Jelinek2-8/+43
OpenMP Nesting of Regions restrictions say: - If a target update, target data, target enter data, or target exit data construct is encountered during execution of a target region, the behavior is unspecified. - If a target construct is encountered during execution of a target region and a device clause in which the ancestor device-modifier appears is not present on the construct, the behavior is unspecified. That wording is about the dynamic (runtime) behavior, not about lexical nesting, so while it is UB if omp target * is encountered in the target region, we need to make it compile and link (for lexical nesting of target * inside of target we actually emit a warning). To make this work, I had to do multiple changes. One was to mark .omp_data_{sizes,kinds}.* variables when static as "omp declare target". Another one was to add stub GOMP_target* entrypoints to nvptx and gcn libgomp.a. The entrypoint functions shouldn't be called or passed in the offload regions, otherwise libgomp: cuLaunchKernel error: too many resources requested for launch was reported; fixed by changing those arguments of calls to GOMP_target_ext to NULL. And we didn't mark the entrypoints "omp target entrypoint" when the caller has been "omp declare target". 2021-05-26 Jakub Jelinek <jakub@redhat.com> PR libgomp/100573 gcc/ * omp-low.c: Include omp-offload.h. (create_omp_child_function): If current_function_decl has "omp declare target" attribute and is_gimple_omp_offloaded, remove that attribute from the copy of attribute list and add "omp target entrypoint" attribute instead. (lower_omp_target): Mark .omp_data_sizes.* and .omp_data_kinds.* variables for offloading if in omp_maybe_offloaded_ctx. * omp-offload.c (pass_omp_target_link::execute): Nullify second argument to GOMP_target_data_ext in offloaded code. libgomp/ * config/nvptx/target.c (GOMP_target_ext, GOMP_target_data_ext, GOMP_target_end_data, GOMP_target_update_ext, GOMP_target_enter_exit_data): New dummy entrypoints. * config/gcn/target.c (GOMP_target_ext, GOMP_target_data_ext, GOMP_target_end_data, GOMP_target_update_ext, GOMP_target_enter_exit_data): Likewise. * testsuite/libgomp.c-c++-common/for-3.c (DO_PRAGMA, OMPTEAMS, OMPFROM, OMPTO): Define. (main): Remove #pragma omp target teams around all the tests. * testsuite/libgomp.c-c++-common/target-41.c: New test. * testsuite/libgomp.c-c++-common/target-42.c: New test.
2021-05-26C-SKY: Delete TARGET_CAN_CHANGE_MODE_CLASS, use defualt definition.Geng Qi1-16/+0
gcc/ChangeLog: * config/csky/csky.c (csky_can_change_mode_class): Delete. For csky, HF/SF mode use the low bits of VREGS.
2021-05-26Fix C++ libgomp regressionsEric Botcazou1-1/+1
This is only a stopgap fix. gcc/ * gimplify.c (gimplify_decl_expr): Do not clear TREE_READONLY on a DECL which is a reference for OMP.
2021-05-26DOC: update documentation of __gcov_{dump,reset}Martin Liska1-3/+5
gcc/ChangeLog: PR gcov-profile/100751 * doc/gcov.texi: Document that __gcov_dump can be called just once and that __gcov_reset resets run-time counters.
2021-05-26docs: port old-intall.texi part to install.texiMartin Liska1-14/+58
gcc/ChangeLog: * doc/install.texi: Port relevant part from install-old.texi and re-generate list of CPUs and systems.