- Jan 16, 2025
-
-
Sandra Loosemore authored
gcc/testsuite/ChangeLog * c-c++-common/gomp/adjust-args-6.c: New. * c-c++-common/gomp/attrs-metadirective-1.c: New. * c-c++-common/gomp/attrs-metadirective-2.c: New. * c-c++-common/gomp/attrs-metadirective-3.c: New. * c-c++-common/gomp/attrs-metadirective-4.c: New. * c-c++-common/gomp/attrs-metadirective-5.c: New. * c-c++-common/gomp/attrs-metadirective-6.c: New. * c-c++-common/gomp/attrs-metadirective-7.c: New. * c-c++-common/gomp/attrs-metadirective-8.c: New. * c-c++-common/gomp/declare-variant-arg-exprs.c: New. * c-c++-common/gomp/declare-variant-dynamic-1.c: New. * c-c++-common/gomp/declare-variant-dynamic-2.c: New. * c-c++-common/gomp/metadirective-1.c: New. * c-c++-common/gomp/metadirective-2.c: New. * c-c++-common/gomp/metadirective-3.c: New. * c-c++-common/gomp/metadirective-4.c: New. * c-c++-common/gomp/metadirective-5.c: New. * c-c++-common/gomp/metadirective-6.c: New. * c-c++-common/gomp/metadirective-7.c: New. * c-c++-common/gomp/metadirective-8.c: New. * c-c++-common/gomp/metadirective-construct.c: New. * c-c++-common/gomp/metadirective-device.c: New. * c-c++-common/gomp/metadirective-no-score.c: New. * c-c++-common/gomp/metadirective-target-device-1.c: New. * c-c++-common/gomp/metadirective-target-device-2.c: New. libgomp/ChangeLog * testsuite/libgomp.c-c++-common/metadirective-1.c: New. * testsuite/libgomp.c-c++-common/metadirective-2.c: New. * testsuite/libgomp.c-c++-common/metadirective-3.c: New. * testsuite/libgomp.c-c++-common/metadirective-4.c: New. * testsuite/libgomp.c-c++-common/metadirective-5.c: New. * testsuite/libgomp.c-c++-common/metadirective-late-1.c: New. * testsuite/libgomp.c-c++-common/metadirective-late-2.c: New. * testsuite/libgomp.c-c++-common/metadirective-target-device.c: New. Co-Authored-By:
Kwok Cheung Yeung <kcy@codesourcery.com> Co-Authored-By:
Sandra Loosemore <sandra@codesourcery.com>
-
Sandra Loosemore authored
Additional shared C/C++ testcases are included in a subsequent patch in this series. gcc/cp/ChangeLog PR middle-end/112779 PR middle-end/113904 * cp-tree.h (struct saved_scope): Add new field x_processing_omp_trait_property_expr. (processing_omp_trait_property_expr): New. * parser.cc (cp_parser_skip_to_end_of_block_or_statement): Add metadirective_p parameter and handle skipping over the parentheses in a "for" statement. (struct omp_metadirective_parse_data): New. (mangle_metadirective_region_label): New. (cp_parser_label_for_labeled_statement): Mangle label names in a metadirective body. (cp_parser_jump_statement): Likewise. (cp_parser_omp_context_selector): Allow arbitrary expressions in device_num and condition properties. (cp_parser_omp_assumption_clauses): Handle C_OMP_DIR_META. (analyze_metadirective_body): New. (cp_parser_omp_metadirective): New. (cp_parser_pragma): Handle PRAGMA_OMP_METADIRECTIVE. * parser.h (struct cp_parser): Add omp_metadirective_state field. * pt.cc (tsubst_omp_context_selector): New. (tsubst_stmt): Handle OMP_METADIRECTIVE. * semantics.cc (finish_id_expression_1): Don't diagnose use of parameter outside function body in dynamic selector expressions here. gcc/testsuite/ PR middle-end/112779 PR middle-end/113904 * c-c++-common/gomp/declare-variant-2.c: Adjust output for C++. * g++.dg/gomp/declare-variant-class-1.C: New. * g++.dg/gomp/declare-variant-class-2.C: New. * g++.dg/gomp/metadirective-template-1.C: New. libgomp/ PR middle-end/112779 PR middle-end/113904 * testsuite/libgomp.c++/metadirective-template-1.C: New. * testsuite/libgomp.c++/metadirective-template-2.C: New. * testsuite/libgomp.c++/metadirective-template-3.C: New. Co-Authored-By:
Kwok Cheung Yeung <kcy@codesourcery.com> Co-Authored-By:
Sandra Loosemore <sandra@codesourcery.com>
-
Sandra Loosemore authored
Additional shared C/C++ testcases are included in a subsequent patch in this series. gcc/c-family/ChangeLog PR middle-end/112779 PR middle-end/113904 * c-common.h (enum c_omp_directive_kind): Add C_OMP_DIR_META. (c_omp_expand_variant_construct): Declare. * c-gimplify.cc: Include omp-general.h. (genericize_omp_metadirective_stmt): New. (c_genericize_control_stmt): Add case for OMP_METADIRECTIVE. * c-omp.cc (c_omp_directives): Fix entries for metadirective. (c_omp_expand_variant_construct_r): New. (c_omp_expand_variant_construct): New. * c-pragma.cc (omp_pragmas): Add metadirective. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_METADIRECTIVE. gcc/c/ChangeLog PR middle-end/112779 PR middle-end/113904 * c-parser.cc (struct c_parser): Add omp_metadirective_state field. (c_parser_skip_to_end_of_block_or_statement): Add metadirective_p parameter and handle skipping over the parentheses in a "for" statement. (struct omp_metadirective_parse_data): New. (mangle_metadirective_region_label): New. (c_parser_label): Mangle label names in a metadirective body. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): Handle PRAGMA_OMP_METADIRECTIVE. (c_parser_omp_context_selector): Allow arbitrary expressions in device_num and condition properties. (c_parser_omp_assumption_clauses): Handle C_OMP_DIR_META. (analyze_metadirective_body): New. (c_parser_omp_metadirective): New. gcc/testsuite/ PR middle-end/112779 * c-c++-common/gomp/declare-variant-2.c: Adjust expected output for C. * gcc.dg/gomp/metadirective-1.c: New. Co-Authored-By:
Kwok Cheung Yeung <kcy@codesourcery.com> Co-Authored-By:
Sandra Loosemore <sandra@codesourcery.com>
-
Peter Bergner authored
For invalid constant operand values used in built-in functions, return const0_rtx to signify an error occurred during expansion. 2025-01-16 Peter Bergner <bergner@linux.ibm.com> gcc/ * config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Return const0_rtx when there is an error. gcc/testsuite/ * gcc.target/powerpc/mma-builtin-error.c: New test.
-
Peter Bergner authored
The loop checking for built-in constant operand restrictions was missing some operands due to the loop limit being too small. Fixing that exposed a testsuite failure which is caused by a typo in the pmxvi4ger8pp definition where we had made the PMASK field too small. 2025-01-16 Peter Bergner <bergner@linux.ibm.com> gcc/ * config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Use correct array size for the loop limit. * config/rs6000/rs6000-builtins.def: Fix field size for PMASK operand.
-
Jakub Jelinek authored
The embed-17.C testcase is miscompiled and pr118214.C testcase used to be miscompiled on the trunk before I've temporarily reverted the r15-6339 C++ large initializer speed-up commit in r15-6448. The problem is that reshape_* is only sometimes allowed to modify the given CONSTRUCTOR in place (when reuse is true, so first_initializer_p && (complain & tf_error) && !CP_AGGREGATE_TYPE_P (elt_type) && !TREE_SIDE_EFFECTS (first_initializer_p) ) and at other times is not allowed to change it. But the RAW_DATA_CST handling was modifying those in place always, by peeling off whatever was needed for the processing of the current element or set of elements and leaving the rest in the original CONSTRUCTOR_ELTS, either as RAW_DATA_CST with adjusted RAW_DATA_POINTER/RAW_DATA_LENGTH, or turning it into INTEGER_CST if it would be a RAW_DATA_LENGTH == 1 RAW_DATA_CST. The following patch fixes that by adding raw_idx member into struct reshape_iter where we for the RAW_DATA_CST current elements track offset into the current RAW_DATA_CST (how many elements were processed from it already) and modifying the original CONSTRUCTOR_ELTS only if reuse is true and we used the whole RAW_DATA_CST (with zero raw_idx); which means just modifying its type in place. 2025-01-16 Jakub Jelinek <jakub@redhat.com> PR c++/118214 * decl.cc (struct reshape_iter): Add raw_idx member. (cp_maybe_split_raw_data): Add inc_cur parameter, set *inc_cur, don't modify original CONSTRUCTOR, use d->raw_idx to track index into a RAW_DATA_CST d->cur->value. (consume_init): Adjust cp_maybe_split_raw_data caller, increment d->cur when cur_inc is true. (reshape_init_array_1): Don't modify original CONSTRUCTOR when handling RAW_DATA_CST d->cur->value and !reuse, instead use d->raw_idx to track index into RAW_DATA_CST. (reshape_single_init): Initialize iter.raw_idx. (reshape_init_class): Adjust for introduction of d->raw_idx, adjust cp_maybe_split_raw_data caller, do d->cur++ if inc_cur rather than when it returns non-NULL. (reshape_init_r): Check for has_designator_problem for second half of _Complex earlier, also check for error_operand_p (d->cur->value). Use consume_init instead of cp_maybe_split_raw_data with later conditional d->cur++. (reshape_init): Initialize d.raw_idx. * g++.dg/cpp/embed-17.C: New test. * g++.dg/cpp0x/pr118214.C: New test.
-
Jakub Jelinek authored
This is something we should have done when -std=c++23 was made the primary option and -std=c++2b turned into undocumented alias. 2025-01-16 Jakub Jelinek <jakub@redhat.com> gcc/cp/ * parser.cc (cp_parser_lambda_declarator_opt, cp_parser_statement, cp_parser_selection_statement, cp_parser_jump_statement): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b. * semantics.cc (finish_compound_literal): Likewise. * typeck2.cc (build_functional_cast_1): Likewise. * decl.cc (start_decl): Likewise. * constexpr.cc (ensure_literal_type_for_constexpr_object, potential_constant_expression_1): Likewise. gcc/c-family/ * c-lex.cc (interpret_float): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b.
-
Tamar Christina authored
When this test was added initially it didn't add the early break effective target tests. This means that the test was "passing" (as in, it was failing to vectorize) because many targets don't support early break. But the test should not have been run for these targets. When the vectorizer learned PFA the test started passing for 32-bit targets. I had adjusted the testcase but fail to notice the requirements were wrong. Thus this adds the extra guards, and on targets that don't support early break this test will move to UNSUPPORTED, which is what it should have been all along... gcc/testsuite/ChangeLog: PR testsuite/118451 * gcc.dg/vect/vect-switch-search-line-fast.c: Add early_break guards.
-
Thomas Schwinge authored
In 2019 commit 62aee289 "Add OpenACC 2.6 `serial' construct support", we didn't quite excel in test suite coverage. Add some more, similar to OpenACC 'parallel' construct testing. gcc/testsuite/ * c-c++-common/goacc-gomp/nesting-1.c: Extend OpenACC 'serial' testing. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/Wparentheses-1.c: Likewise. * c-c++-common/goacc/builtin-goacc-parlevel-id-size.c: Likewise. * c-c++-common/goacc/combined-directives-2.c: Likewise. * c-c++-common/goacc/combined-directives-3.c: Likewise. * c-c++-common/goacc/combined-directives.c: Likewise. * c-c++-common/goacc/combined-reduction.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/default-1.c: Likewise. * c-c++-common/goacc/default-2.c: Likewise. * c-c++-common/goacc/default-3.c: Likewise. * c-c++-common/goacc/default-4.c: Likewise. * c-c++-common/goacc/default-5.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-clauses.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/private-reduction-1.c: Likewise. * c-c++-common/goacc/reduction-promotions.c: Likewise. * c-c++-common/goacc/routine-1.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/uninit-firstprivate-clause.c: Likewise. * c-c++-common/goacc/uninit-if-clause.c: Likewise. * c-c++-common/goacc/update-if_present-2.c: Likewise. * g++.dg/goacc/template.C: Likewise. * gfortran.dg/goacc/array-reduction.f90: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/coarray_2.f90: Likewise. * gfortran.dg/goacc/combined-directives-3.f90: Likewise. * gfortran.dg/goacc/combined-directives.f90: Likewise. * gfortran.dg/goacc/common-block-1.f90: Likewise. * gfortran.dg/goacc/common-block-2.f90: Likewise. * gfortran.dg/goacc/common-block-3.f90: Likewise. * gfortran.dg/goacc/cray-2.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/default-1.f95: Likewise. * gfortran.dg/goacc/default-2.f: Likewise. * gfortran.dg/goacc/default-3.f95: Likewise. * gfortran.dg/goacc/default-4.f: Likewise. * gfortran.dg/goacc/default-5.f: Likewise. * gfortran.dg/goacc/default_none.f95: Likewise. * gfortran.dg/goacc/derived-types.f90: Likewise. * gfortran.dg/goacc/firstprivate-1.f95: Likewise. * gfortran.dg/goacc/gang-static.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1-2.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2-parallel-3.f95: Likewise. * gfortran.dg/goacc/loop-3-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/multi-clause.f90: Likewise. * gfortran.dg/goacc/nested-parallelism.f90: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/pr71704.f90: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction-3.f95: Likewise. * gfortran.dg/goacc/reduction-promotions.f90: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-3.f90: Likewise. * gfortran.dg/goacc/routine-module-1.f90: Likewise. * gfortran.dg/goacc/routine-module-2.f90: Likewise. * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/goacc/uninit-firstprivate-clause.f95: Likewise. * gfortran.dg/goacc/uninit-if-clause.f95: Likewise. * gfortran.dg/goacc/update-if_present-2.f90: Likewise. * c-c++-common/goacc/loop-3.c: Rename to... * c-c++-common/goacc/loop-3-parallel.c: ... this. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Rename to... * gfortran.dg/goacc/compute_construct-clauses.f95: ... this. Extend OpenACC 'serial' testing. * gfortran.dg/goacc/parallel-kernels-regions.f95: Rename to... * gfortran.dg/goacc/nesting-fail-1.f95: ... this. Extend OpenACC 'serial' testing. * gfortran.dg/goacc/routine-external-level-of-parallelism-1.f: Rename to... * gfortran.dg/goacc/routine-external-level-of-parallelism-1-parallel.f: ... this. * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Rename to... * gfortran.dg/goacc/routine-external-level-of-parallelism-2-parallel.f: ... this. * c-c++-common/goacc/loop-2-serial.c: New. * c-c++-common/goacc/loop-3-serial.c: Likewise. * c-c++-common/goacc/nested-reductions-1-serial.c: Likewise. * c-c++-common/goacc/nested-reductions-2-serial.c: Likewise. * c-c++-common/goacc/serial-1.c: Likewise. * gfortran.dg/goacc/loop-2-serial-3.f95: Likewise. * gfortran.dg/goacc/loop-2-serial-nested.f95: Likewise. * gfortran.dg/goacc/loop-2-serial-tile.f95: Likewise. * gfortran.dg/goacc/loop-2-serial.f95: Likewise. * gfortran.dg/goacc/nested-reductions-1-serial.f90: Likewise. * gfortran.dg/goacc/nested-reductions-2-serial.f90: Likewise. * gfortran.dg/goacc/private-explicit-serial-1.f95: Likewise. * gfortran.dg/goacc/private-predetermined-serial-1.f95: Likewise. * gfortran.dg/goacc/routine-external-level-of-parallelism-1-serial.f: Likewise. * gfortran.dg/goacc/routine-external-level-of-parallelism-2-serial.f: Likewise. * gfortran.dg/goacc/serial-tree.f95: Likewise.
-
Thomas Schwinge authored
For easier maintenance. gcc/testsuite/ * gfortran.dg/goacc/assumed.f95: Use relative line numbers for a few DejaGnu directives. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/loop-1-2.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise.
-
Tobias Burnus authored
For intrinsic routines, called in libraries, the prototype is created from the call via gfc_get_symbol_for_expr. For the actual arguments, it calls gfc_copy_formal_args_intr which already ensures that the ts.u.cl is freshly allocated. This commit now ensures the same for character-returning functions. PR fortran/118441 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_get_symbol_for_expr): Use gfc_new_charlen for character-returning functions. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/intrinsic_pack_7.f90: New test.
-
Jonathan Wakely authored
This adds <bits/ostream.h> so that other headers don't need to include all of <ostream>, which pulls in all of <format> since C++23 (for the std::print and std::println overloads in <ostream>). This new header allows the constrained operator<< in <bits/unique_ptr.h> to be defined without all of std::format being compiled. We could also replace <ostream> with <bits/ostream.h> in all of <istream>, <fstream>, <sstream>, and <spanstream>. That seems more likely to cause problems for users who might be expecting <sstream> to define std::endl, for example. Although the standard doesn't guarantee that, it is more reasonable than expecting <memory> to define it! We can look into making those changes for GCC 16. libstdc++-v3/ChangeLog: PR libstdc++/99995 * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/unique_ptr.h: Include bits/ostream.h instead of ostream. * include/std/ostream: Include new header. * include/bits/ostream.h: New file.
-
Jonathan Wakely authored
Do not report an error for (is_other(s1) && is_other(s2)) as the standard originally said, nor for (is_other(s1) || is_other(s2)) as libstdc++ was doing. We can compare inode numbers for special files and so give sensible answers. libstdc++-v3/ChangeLog: PR libstdc++/118158 * src/c++17/fs_ops.cc (fs::equivalent): Remove error reporting for is_other(s1) && is_other(s2) case, as per LWG 2937. * testsuite/27_io/filesystem/operations/pr118158.cc: New test.
-
Jonathan Wakely authored
Replace some `__cplusplus > 201402L` preprocessor checks with more expressive checks for the appropriate feature test macro. libstdc++-v3/ChangeLog: * include/bits/stl_map.h: Check __glibcxx_node_extract instead of __cplusplus. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_tree.h: Likewise.
-
Liao Shihua authored
Update Sifive Xsfvqmacc and Xsfvfnrclip extension's testcases. version log: Update synchronize LMUL settings with return type. gcc/ChangeLog: * config/riscv/vector.md: New attr set. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/xsfvector/sf_vfnrclip_x_f_qf.c: Add vsetivli checking. * gcc.target/riscv/rvv/xsfvector/sf_vfnrclip_xu_f_qf.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmacc_2x8x2.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmacc_4x8x4.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccsu_2x8x2.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccsu_4x8x4.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccu_2x8x2.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccu_4x8x4.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccus_2x8x2.c: Ditto. * gcc.target/riscv/rvv/xsfvector/sf_vqmaccus_4x8x4.c: Ditto.
-
Jiawei authored
Update implementation of Xsfvfnrclip, using return type as iterator. gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc (expand_floattype): New func. (main): New type. * config/riscv/riscv-vector-builtins-types.def (DEF_RVV_XFQF_OPS): New def. (vint8mf8_t): Ditto. (vint8mf4_t): Ditto. (vint8mf2_t): Ditto. (vint8m1_t): Ditto. (vint8m2_t): Ditto. * config/riscv/riscv-vector-builtins.cc (DEF_RVV_XFQF_OPS): Ditto. (rvv_arg_type_info::get_xfqf_float_type): Ditto. * config/riscv/riscv-vector-builtins.def (xfqf_vector): Ditto. (xfqf_float): Ditto. * config/riscv/riscv-vector-builtins.h (struct rvv_arg_type_info): New function prototype. * config/riscv/sifive-vector.md: Update iterator. * config/riscv/vector-iterators.md: Ditto.
-
Christoph Müllner authored
As reported in PR118487, it is possible that the mask parameter of a __builtin_shuffle() is not a VECTOR_CST. If this is the case and checking is enabled then an ICE is triggered. Let's add a check to fix this issue. PR tree-optimization/118487 gcc/ChangeLog: * tree-ssa-forwprop.cc (recognise_vec_perm_simplify_seq): Ensure that shuffle masks are VECTOR_CSTs. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr118487.c: New test. Signed-off-by:
Christoph Müllner <christoph.muellner@vrull.eu>
-
Christoph Müllner authored
When extracting the amount of vector elements, we currently first check if the value is a contant with is_constant(), followed by obtaining the value with to_constant(), which internally calls is_constant() again. We can address this by using is_constant (T*), which also provides the constant value. gcc/ChangeLog: * tree-ssa-forwprop.cc (recognise_vec_perm_simplify_seq): Eliminate redundant calls to to_constant(). Signed-off-by:
Christoph Müllner <christoph.muellner@vrull.eu>
-
Richard Biener authored
When we PHI translate dependent expressions we keep SSA defs in place of the translated expression in case the expression itself did not change even though it's context did and thus the validity of ranges associated with it. That eventually leads to simplification errors given we violate the precondition that used SSA defs fed to vn_valueize are valid to use (including their associated ranges). The following makes sure to replace those with new representatives always, not only when the dependent expression translation changed it. The fix was originally discovered by Michael Morin. PR tree-optimization/115494 * tree-ssa-pre.cc (phi_translate_1): Always generate a representative for translated dependent expressions. * gcc.dg/torture/pr115494.c: New testcase. Co-Authored-By:
Mikael Morin <mikael@gcc.gnu.org>
-
Jakub Jelinek authored
This patch ensures that VRP or similar passes don't replace the uses of lhs of [[gnu::musttail]] calls with some constant (e.g. if the call is known is known to return a singleton value range) etc. to make it more likely that it is actually tail callable. 2025-01-16 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/118430 * tree-ssa-propagate.cc (may_propagate_copy): Return false if dest is lhs of an [[gnu::musttail]] call. (substitute_and_fold_dom_walker::before_dom_children): Formatting fix. * c-c++-common/musttail14.c: Expect lhs on the must tail call calls.
-
Jakub Jelinek authored
When we have return somefn (whatever); where somefn is normally tail callable and IPA-VRP determines somefn returns a singleton range, VRP just changes the IL to somefn (whatever); return 42; (or whatever the value in that range is). The introduction of IPA-VRP return value tracking then effectively regresses the tail call optimization. This is even more important if the call is [[gnu::musttail]]. So, the following patch queries IPA-VRP whether a function returns singleton range and if so and the value returned is identical to that, marks the call as [tail call] anyway. If expansion decides it can't use the tail call, we'll still expand the return 42; or similar statement, and if it decides it can use the tail call, that part will be ignored and we'll emit normal tail call. The reason it works is that the expand pass relies on the tailc pass to do its job properly. E.g. when we have <bb 2> [local count: 1073741824]: foo (x_2(D)); baz (&v); v ={v} {CLOBBER(eos)}; bar (x_2(D)); [tail call] return 1; when expand_gimple_basic_block handles the bar (x_2(D)); call, it uses if (call_stmt && gimple_call_tail_p (call_stmt)) { bool can_fallthru; new_bb = expand_gimple_tailcall (bb, call_stmt, &can_fallthru); if (new_bb) { if (can_fallthru) bb = new_bb; else { currently_expanding_gimple_stmt = NULL; return new_bb; } } } As it is actually tail callable during expansion of the bar (x_2(D)); call stmt, expand_gimple_tailbb returns non-NULL and sets can_fallthru to false, plus emits ;; bar (x_2(D)); [tail call] (insn 11 10 12 2 (set (reg:SI 5 di) (reg/v:SI 99 [ x ])) "pr118430.c":35:10 -1 (nil)) (call_insn/j 12 11 13 2 (set (reg:SI 0 ax) (call (mem:QI (symbol_ref:DI ("bar") [flags 0x3] <function_decl 0x7fb39020bd00 bar>) [0 bar S1 A8]) (const_int 0 [0]))) "pr118430.c":35:10 -1 (expr_list:REG_CALL_DECL (symbol_ref:DI ("bar") [flags 0x3] <function_decl 0x7fb39020bd00 bar>) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil))) (expr_list:SI (use (reg:SI 5 di)) (nil))) (barrier 13 12 0) Because it doesn't fallthru, no further statements in the same bb are expanded. Now, if the bb with return happened to be in some other basic block from the [tail call], it could be expanded but because the bb with tail call ends with a barrier, it doesn't fall thru there and if nothing else could reach it, we'd remove the unreachable bb RSN. 2025-01-16 Jakub Jelinek <jakub@redhat.com> Andrew Pinski <quic_apinski@quicinc.com> PR tree-optimization/118430 * tree-tailcall.cc: Include gimple-range.h, alloc-pool.h, sreal.h, symbol-summary.h, ipa-cp.h and ipa-prop.h. (find_tail_calls): If ass_var is NULL and ret_var is not, check if IPA-VRP has not found singleton return range for it. In that case, don't punt if ret_var is the only value in that range. Adjust the maybe_error_musttail message otherwise to diagnose different value being returned from the caller and callee rather than using return slot. Formatting fixes. * c-c++-common/musttail14.c: New test. * c-c++-common/pr118430.c: New test.
-
Jakub Jelinek authored
When writing the gcc-15/changes.html patch posted earlier, I've been wondering where significant part of the Basic asm chapter went and the problem was the insertion of a new @node in the middle of the Basic Asm @node, plus not mentioning the new @node in the @menu. So the asm constexpr node was not normally visible and the Remarks for the section neither. The following patch moves it before Asm Labels, removes the spots where it described what hasn't been actually committed (constant expression can only be a container with data/size member functions) and fixes up the toplevel extended asm documentation (it was in the Basic Asm remarks and Extended Asm section's remark still said it is not valid). 2025-01-16 Jakub Jelinek <jakub@redhat.com> * doc/extend.texi (Using Assembly Language with C): Add Asm constexprs to @menu. (Basic Asm): Move @node asm constexprs before Asm Labels, rename to Asm constexprs, change wording so that it is clearer that the constant expression actually must not return a string literal, just some specific container and other wording tweaks. Only talk about top-level for basic asms in this @node, move restrictions on top-level extended asms to ... (Extended Asm): ... here.
-
Jakub Jelinek authored
For T with non-trivial destructors, we were destructing objects in the vector on release only when not using auto storage of auto_vec. The following patch calls truncate (0) instead of m_vecpfx.m_num clearing, and truncate takes care of that destruction: unsigned l = length (); gcc_checking_assert (l >= size); if (!std::is_trivially_destructible <T>::value) vec_destruct (address () + size, l - size); m_vecpfx.m_num = size; 2025-01-16 Jakub Jelinek <jakub@redhat.com> PR ipa/118400 * vec.h (vec<T, va_heap, vl_ptr>::release): Call m_vec->truncate (0) instead of clearing m_vec->m_vecpfx.m_num.
-
liuhongt authored
gcc/ChangeLog: PR target/118489 * config/i386/sse.md (VF1_AVX512BW): Fix typo. gcc/testsuite/ChangeLog: * gcc.target/i386/pr118489.c: New test.
-
Richard Biener authored
The following addresses the fact that with loop masking (or regular mask loads) we do not implement load shortening but we override the case where we need that for correctness. Likewise when we attempt to use loop masking to handle large trailing gaps we cannot do so when there's this overrun case. PR tree-optimization/115895 * tree-vect-stmts.cc (get_group_load_store_type): When we might overrun because the group size is not a multiple of the vector size we cannot use loop masking since that does not implement the required load shortening. * gcc.target/i386/vect-pr115895.c: New testcase.
-
Keith Packard authored
lm32 has 8 register parameter slots, so many vararg functions end up with several anonymous parameters passed in registers. If we run out of registers in the middle of a parameter, the entire parameter will be placed on the stack, skipping any remaining available registers. The receiving varargs function doesn't know this, and will save all of the possible parameter register values just below the stack parameters. When processing a va_arg call with a type size larger than a single register, we must check to see if it spans the boundary between register and stack parameters. If so, we need to skip to the stack parameters. This is done by making va_list a structure containing the arg pointer and the address of the start of the stack parameters. Boundary checks are inserted in va_arg calls to detect this case and the address of the parameter is set to the stack parameter start when the parameter crosses over. gcc/ * config/lm32/lm32.cc: Add several #includes. (va_list_type): New. (lm32_build_va_list): New function. (lm32_builtin_va_start): Likewise. (lm32_sd_gimplify_va_arg_expr): Likewise. (lm32_gimplify_va_arg_expr): Likewise.
-
Keith Packard authored
gcc/ * config/lm32/lm32.cc (setup_incoming_varargs): Adjust the conditionals so that pretend_size is always computed, even if no_rtl is set.
-
Keith Packard authored
The cumulative args value in setup_incoming_varargs points at the last named parameter. We need to skip over that (if present) to get to the first anonymous argument as we only want to include those anonymous args in the saved register block. gcc/ * config/lm32/lm32.cc (lm32_setup_incoming_varargs): Skip last named parameter when preparing to flush registers with unnamed arguments to th stack.
-
Keith Packard authored
* config/lm32/lm32.cc (lm32_function_arg): Pass unnamed arguments in registers too, just like named arguments.
-
Andi Kleen authored
Committed as obvious. gcc/ChangeLog: * config/i386/x86-tune-sched-core.cc: Fix incorrect comment.
-
Eugene Rozenfeld authored
We are initializing both the call graph node count and the entry block count of the function with the head_count value from the profile. Count propagation algorithm may refine the entry block count and we may end up with a case where the call graph node count is set to zero but the entry block count is non-zero. That becomes a problem because we have this code in execute_fixup_cfg: profile_count num = node->count; profile_count den = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; bool scale = num.initialized_p () && !(num == den); Here if num is 0 but den is not 0, scale becomes true and we lose the counts in if (scale) bb->count = bb->count.apply_scale (num, den); This is what happened in the issue reported in PR116743 (a 10% regression in MySQL HAMMERDB tests). 3d9e6767 made an improvement in AutoFDO count propagation, which caused a mismatch between the call graph node count (zero) and the entry block count (non-zero) and subsequent loss of counts as described above. The fix is to update the call graph node count once we've done count propagation. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: PR gcov-profile/116743 * auto-profile.cc (afdo_annotate_cfg): Fix mismatch between the call graph node count and the entry block count.
-
GCC Administrator authored
-
- Jan 15, 2025
-
-
Jonathan Wakely authored
This test should use __cpp_lib_ios_noreplace rather than the internal __glibcxx_ios_noreplace macro. libstdc++-v3/ChangeLog: * testsuite/27_io/ios_base/types/openmode/case_label.cc: Use standard feature test macro not internal one.
-
Jonathan Wakely authored
The alloc_ptr.cc test for std::set tries to use C++17 features unconditionally, and tries to use the C++23 range members which haven't been implemented for std::set yet. Some of the range checks are left in place but commented out, so they can be added after the ranges members are implemented. Others (such as prepend_range) are not valid for std::set at all. Also fix uses of internal feature test macros in two other tests, which should use the standard __cpp_lib_xxx macros. libstdc++-v3/ChangeLog: * testsuite/23_containers/set/requirements/explicit_instantiation/alloc_ptr.cc: Guard node extraction checks with feature test macro. Remove calls to non-existent range members. * testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr.cc: Use standard macro not internal one. * testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr.cc: Likewise.
-
Andrew Pinski authored
This in this PR we have missed optimization where we miss that, `1 >> x` and `(1 >> x) ^ 1` can't be equal. There are a few ways of optimizing this, the easiest and simpliest is to simplify `1 >> x` into just `x == 0` as those are equivalant (if we ignore out of range values for x). we already have an optimization for `(1 >> X) !=/== 0` so the only difference here is we don't need the `!=/== 0` part to do the transformation. So this removes the `(1 >> X) !=/== 0` transformation and just adds a simplfied `1 >> x` -> `x == 0` one. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/102705 gcc/ChangeLog: * match.pd (`(1 >> X) != 0`): Remove pattern. (`1 >> x`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr105832-2.c: Update testcase. * gcc.dg/tree-ssa/pr96669-1.c: Likewise. * gcc.dg/tree-ssa/pr102705-1.c: New test. * gcc.dg/tree-ssa/pr102705-2.c: New test. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Sam James authored
gcc/ChangeLog: * doc/extend.texi: Cleanup trailing whitespace.
-
Sam James authored
We say 'a constant .. expression' elsewhere. Fix the grammar. gcc/ChangeLog: * doc/extend.texi: Add 'a' for grammar fix.
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/109849 * include/bits/vector.tcc (vector::_M_range_insert): Fix reversed args in length calculation.
-
Harald Anlauf authored
PR fortran/71884 gcc/fortran/ChangeLog: * resolve.cc (resolve_allocate_expr): Reject intrinsic NULL as source-expr. gcc/testsuite/ChangeLog: * gfortran.dg/pr71884.f90: New test.
-
Jakub Jelinek authored
This patch uses the count_ctor_elements function to fix up unify deduction of array sizes. 2025-01-15 Jakub Jelinek <jakub@redhat.com> PR c++/118390 * cp-tree.h (count_ctor_elements): Declare. * call.cc (count_ctor_elements): No longer static. * pt.cc (unify): Use count_ctor_elements instead of CONSTRUCTOR_NELTS. * g++.dg/cpp/embed-20.C: New test. * g++.dg/cpp0x/pr118390.C: New test.
-