[gcc r15-3345] slsr: Use simple_dce_from_worklist in SLSR [PR116554]
https://gcc.gnu.org/g:592a335de563a3a9e36d362c5b9f3fb0a990c1d8 commit r15-3345-g592a335de563a3a9e36d362c5b9f3fb0a990c1d8 Author: Andrew Pinski Date: Sat Aug 31 17:23:19 2024 -0700 slsr: Use simple_dce_from_worklist in SLSR [PR116554] While working on a phiopt patch, it was noticed that SLSR would leave around some unused ssa names. Let's add simple_dce_from_worklist usage to SLSR to remove the dead statements. This should give a small improvemnent for passes afterwards. Boostrapped and tested on x86_64. gcc/ChangeLog: PR tree-optimization/116554 * gimple-ssa-strength-reduction.cc: Include tree-ssa-dce.h. (replace_mult_candidate): Add sdce_worklist argument, mark the rhs1/rhs2 for maybe dceing. (replace_unconditional_candidate): Add sdce_worklist argument, Update call to replace_mult_candidate. (replace_conditional_candidate): Add sdce_worklist argument, update call to replace_mult_candidate. (replace_uncond_cands_and_profitable_phis): Add sdce_worklist argument, update call to replace_conditional_candidate, replace_unconditional_candidate, and replace_uncond_cands_and_profitable_phis. (replace_one_candidate): Add sdce_worklist argument, mark the orig_rhs1/orig_rhs2 for maybe dceing. (replace_profitable_candidates): Add sdce_worklist argument, update call to replace_one_candidate and replace_profitable_candidates. (analyze_candidates_and_replace): Call simple_dce_from_worklist and update calls to replace_profitable_candidates, and replace_uncond_cands_and_profitable_phis. Signed-off-by: Andrew Pinski Diff: --- gcc/gimple-ssa-strength-reduction.cc | 59 +--- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/gcc/gimple-ssa-strength-reduction.cc b/gcc/gimple-ssa-strength-reduction.cc index 1cb3625c7ebe..39cd9339c778 100644 --- a/gcc/gimple-ssa-strength-reduction.cc +++ b/gcc/gimple-ssa-strength-reduction.cc @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-affine.h" #include "tree-eh.h" #include "builtins.h" +#include "tree-ssa-dce.h" /* Information about a strength reduction candidate. Each statement in the candidate table represents an expression of one of the @@ -2126,7 +2127,8 @@ cand_already_replaced (slsr_cand_t c) replace_conditional_candidate. */ static void -replace_mult_candidate (slsr_cand_t c, tree basis_name, offset_int bump) +replace_mult_candidate (slsr_cand_t c, tree basis_name, offset_int bump, + auto_bitmap &sdce_worklist) { tree target_type = TREE_TYPE (gimple_assign_lhs (c->cand_stmt)); enum tree_code cand_code = gimple_assign_rhs_code (c->cand_stmt); @@ -2193,6 +2195,11 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, offset_int bump) if (cand_code != NEGATE_EXPR) { rhs1 = gimple_assign_rhs1 (c->cand_stmt); rhs2 = gimple_assign_rhs2 (c->cand_stmt); + /* Mark the 2 original rhs for maybe DCEing. */ + if (TREE_CODE (rhs1) == SSA_NAME) + bitmap_set_bit (sdce_worklist, SSA_NAME_VERSION (rhs1)); + if (TREE_CODE (rhs2) == SSA_NAME) + bitmap_set_bit (sdce_worklist, SSA_NAME_VERSION (rhs2)); } if (cand_code != NEGATE_EXPR && ((operand_equal_p (rhs1, basis_name, 0) @@ -2237,7 +2244,7 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, offset_int bump) folded value ((i - i') * S) is referred to here as the "bump." */ static void -replace_unconditional_candidate (slsr_cand_t c) +replace_unconditional_candidate (slsr_cand_t c, auto_bitmap &sdce_worklist) { slsr_cand_t basis; @@ -2247,7 +2254,8 @@ replace_unconditional_candidate (slsr_cand_t c) basis = lookup_cand (c->basis); offset_int bump = cand_increment (c) * wi::to_offset (c->stride); - replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump); + replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump, + sdce_worklist); } /* Return the index in the increment vector of the given INCREMENT, @@ -2507,7 +2515,8 @@ create_phi_basis (slsr_cand_t c, gimple *from_phi, tree basis_name, basis. */ static void -replace_conditional_candidate (slsr_cand_t c) +replace_conditional_candidate (slsr_cand_t c, auto_bitmap &sdce_worklist) + { tree basis_name, name; slsr_cand_t basis; @@ -2527,7 +2536,7 @@ replace_conditional_candidate (slsr_cand_t c) /* Replace C with an add of the new basis phi and a constant. */ offset_int bump = c->index * wi::to_offset (c->stride); - replace_mult_candidate (c, name, bump); + replace_mult_candidate (c, name, bump, sdce_worklist); } /* Recursive helper function for phi_add_costs. SPREAD is a measure of @@ -2608,7
[gcc r15-3342] i386: Support read-modify-write memory operands in STV.
https://gcc.gnu.org/g:bac00c34226bac3a95979b21dc2d668a96b14f6e commit r15-3342-gbac00c34226bac3a95979b21dc2d668a96b14f6e Author: Roger Sayle Date: Sat Aug 31 14:17:18 2024 -0600 i386: Support read-modify-write memory operands in STV. This patch enables STV when the first operand of a TImode binary logic operand (AND, IOR or XOR) is a memory operand, which is commonly the case with read-modify-write instructions. A different motivating example from the one given previously is: __int128 m, p, q; void foo() { m ^= (p & q); } Currently with -O2 -mavx the RMW instructions are rejected by STV, resulting in scalar code: foo:movqp(%rip), %rax movqp+8(%rip), %rdx andqq(%rip), %rax andqq+8(%rip), %rdx xorq%rax, m(%rip) xorq%rdx, m+8(%rip) ret With this patch they become scalar-to-vector candidates: foo:vmovdqa p(%rip), %xmm0 vpand q(%rip), %xmm0, %xmm0 vpxor m(%rip), %xmm0, %xmm0 vmovdqa %xmm0, m(%rip) ret 2024-08-31 Roger Sayle gcc/ChangeLog * config/i386/i386-features.cc (timode_scalar_to_vector_candidate_p): Support the first operand of AND, IOR and XOR being MEM_P, i.e. a read-modify-write insn. gcc/testsuite/ChangeLog * gcc.target/i386/movti-2.c: Change dg-options to -Os. * gcc.target/i386/movti-4.c: Expected output of original movti-2.c. Diff: --- gcc/config/i386/i386-features.cc| 6 -- gcc/testsuite/gcc.target/i386/movti-2.c | 2 +- gcc/testsuite/gcc.target/i386/movti-4.c | 11 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index c09a5c73a8e3..3434d0069439 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -2330,14 +2330,16 @@ timode_scalar_to_vector_candidate_p (rtx_insn *insn) || CONST_SCALAR_INT_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1 return true; - return REG_P (XEXP (src, 0)) + return (REG_P (XEXP (src, 0)) + || timode_mem_p (XEXP (src, 0))) && (REG_P (XEXP (src, 1)) || CONST_SCALAR_INT_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1))); case IOR: case XOR: - return REG_P (XEXP (src, 0)) + return (REG_P (XEXP (src, 0)) + || timode_mem_p (XEXP (src, 0))) && (REG_P (XEXP (src, 1)) || CONST_SCALAR_INT_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1))); diff --git a/gcc/testsuite/gcc.target/i386/movti-2.c b/gcc/testsuite/gcc.target/i386/movti-2.c index 73f69d290cbd..c3a6ae3c51de 100644 --- a/gcc/testsuite/gcc.target/i386/movti-2.c +++ b/gcc/testsuite/gcc.target/i386/movti-2.c @@ -1,5 +1,5 @@ /* { dg-do compile { target int128 } } */ -/* { dg-options "-O2 -mavx" } */ +/* { dg-options "-Os -mavx" } */ __int128 m; void foo() diff --git a/gcc/testsuite/gcc.target/i386/movti-4.c b/gcc/testsuite/gcc.target/i386/movti-4.c new file mode 100644 index ..eac66fcbf3d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movti-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx" } */ +__int128 m; + +void foo() +{ +m &= ((__int128)0x0123456789abcdefULL<<64) | 0x0123456789abcdefULL; +} + +/* { dg-final { scan-assembler-times "movabsq" 1 } } */ +/* { dg-final { scan-assembler-times "vpand" 1 } } */
[gcc/aoliva/heads/testme] (186 commits) testsuite: introduce hostedlib effective target
The branch 'aoliva/heads/testme' was updated to point to: 62b70aa09f1c... testsuite: introduce hostedlib effective target It previously pointed to: beba216fee9f... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST): --- beba216... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra ce14000... Optimize initialization of small padded objects Summary of changes (added commits): --- 62b70aa... testsuite: introduce hostedlib effective target 673a448... Optimize initialization of small padded objects (*) 08693e2... Daily bump. (*) b1765a5... c++: add fixed test [PR101099] (*) ffd56dc... c++: add fixed test [PR115616] (*) f93a38f... c++: fix used but not defined warning for friend (*) b222122... Fortran: default-initialization of derived-type function re (*) 5020f8e... gdbhooks: Fix printing of vec with vl_ptr layout (*) 3fb9072... Don't remove /usr/lib and /lib from when passing to the lin (*) 4d2cbe2... middle-end: Remove integer_three_node [PR116537] (*) 04d11de... expand: Small speed up expansion of __builtin_prefetch (*) 87ce817... PR modula2/116181: m2rts fix -Wodr warning (*) d48273f... Avoid division by zero via constant_multiple_p (*) e7c7397... Do not bother with reassociation in SLP discovery for singl (*) b748e2e... c++: Allow standard attributes after closing square bracket (*) ab214ef... Check avx upper register for parallel. (*) 350d627... Daily bump. (*) aff7f67... SARIF output: implement embedded URLs in messages (§3.11.6 (*) e31b617... pretty-print: reimplement pp_format with a new struct pp_to (*) 68a0ca6... pretty-print: move class chunk_info into its own header (*) 464a3d2... Use std::unique_ptr for optinfo_item (*) 6bfeba1... Fortran: fix ICE with use with rename of namelist member [P (*) 81c4798... hppa: Fix handling of unscaled index addresses on HP-UX (*) 215c7e3... expand: Allow widdening optab when expanding popcount==1 [P (*) cdd5dd2... ada: Fix assertion failure on private limited with clause (*) d506247... ada: Fix internal error on concatenation of discriminant-de (*) a50584b... ada: Missing legality check when type completed (*) 4994069... ada: Fix missing finalization for call to function returnin (*) c2e3326... ada: Print Insertion_Sloc in dmsg (*) bb7a166... ada: Use the same warning character in continuation message (*) ad4c549... ada: Restructure continuation message for pretty printing (*) f60b53c... ada: Improve Inspection_Point warning (*) 4825bbf... ada: Avoid creating continuation messages without an intend (*) f872bba... ada: Parse the attributes of continuation messages correctl (*) 446f415... ada: Use consistent type continuations messages (*) dbaf2c0... ada: Extract line fitting algorithm (*) 299cd64... ada: Ensure validity checks for private scalar types (*) 6a3ff84... ada: Display actual line length in line length check (*) a383d7b... ada: Proper handling for iterator associations in array agg (*) 567e36c... ada: First controlling parameter aspect (*) 6b4b5b4... ada: Update documentation for conditional when constructs (*) ac6d433... Allow subregs around constant displacements [PR116516] (*) 00ec6bd... Make some smallest_int_mode_for_size calls cope with failur (*) 07e5e05... AVR: target/115830 - Make better use of SREG.N and SREG.Z. (*) d9c54e9... c++: don't remove labels during coro-early-expand-ifns [PR1 (*) bd2ccc2... AVR: Outsource code for avr-specific passes to new avr-pass (*) 4b729d2... testsuite: Fix up refactored scanltranstree.exp functions [ (*) 4ff4875... RISC-V: Fix subreg of VLS modes larger than a vector [PR116 (*) 3cb92be... i386: Support wide immediate constants in STV. (*) 155da08... Write LF_MFUNC_ID types for CodeView struct member function (*) c5043d8... Record member functions in CodeView struct definitions (*) 6a9932e... Record static data members in CodeView structs (*) 310fd68... Handle scoping in CodeView LF_FUNC_ID types (*) 3501226... Handle namespaced names for CodeView (*) 6cd806a... Daily bump. (*) 9f79c7d... c++: wrong error due to std::initializer_list opt [PR116476 (*) b8ef805... PR modula2/116181 remove ODR warnings from library interfac (*) 3c89c41... expand: Add debug dump on the cost for `popcount==1` expand (*) b68561d... libstdc++: Fix autoconf check for O_NONBLOCK in (*) 51b0fef... libstdc++: Fix -Wunused-parameter warnings in Networking TS (*) 0e2b3db... libstdc++: Fix -Wunused-variable warning in (*) a59f1cc... libstdc++: Remove unused typedef in (*) 9740a1b... doc: Add Dhruv Matani to Contributors (*) c2ad7b2... libstdc++: Fix @file for target-specific opt_random.h (*) f6ed7a6... libstdc++: Fix @headername for bits/cpp_type_traits.h (*) 898f013... AVR: Overhaul the avr-ifelse RTL optimizatio
[gcc r15-3336] c++, coroutines: Make and use a frame access helper.
https://gcc.gnu.org/g:049a927c100f8ee86ccd71711d70077b0336e966 commit r15-3336-g049a927c100f8ee86ccd71711d70077b0336e966 Author: Iain Sandoe Date: Tue Aug 27 14:52:26 2024 +0100 c++, coroutines: Make and use a frame access helper. In the review of earlier patches it was suggested that we might make use of finish_class_access_expr instead of doing a lookup for the member and then a build_class_access_expr call. finish_class_access_expr does a lot more work than we need and ends up calling build_class_access_expr anyway. So, instead, this patch makes a new helper to do the lookup and build and uses that helper everywhere except instances in the ramp function that we are going to handle separately. gcc/cp/ChangeLog: * coroutines.cc (coro_build_frame_access_expr): New. (transform_await_expr): Use coro_build_frame_access_expr. (transform_local_var_uses): Likewise. (build_actor_fn): Likewise. (build_destroy_fn): Likewise. (cp_coroutine_transform::build_ramp_function): Likewise. Signed-off-by: Iain Sandoe Diff: --- gcc/cp/coroutines.cc | 91 +--- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index f243fe9adae2..20bda5520c0d 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -1670,6 +1670,29 @@ coro_validate_builtin_call (tree call, tsubst_flags_t) The complete bodies for the ramp, actor and destroy function are passed back to finish_function for folding and gimplification. */ +/* Helper to build a coroutine state frame access expression + CORO_FP is a frame pointer + MEMBER_ID is an identifier for a frame field + PRESERVE_REF is true, the expression returned will have REFERENCE_TYPE if + the MEMBER does. + COMPLAIN is passed to the underlying functions. */ + +static tree +coro_build_frame_access_expr (tree coro_ref, tree member_id, bool preserve_ref, + tsubst_flags_t complain) +{ + gcc_checking_assert (INDIRECT_REF_P (coro_ref)); + tree fr_type = TREE_TYPE (coro_ref); + tree mb = lookup_member (fr_type, member_id, /*protect=*/1, /*want_type=*/0, + complain); + if (!mb || mb == error_mark_node) +return error_mark_node; + tree expr += build_class_member_access_expr (coro_ref, mb, NULL_TREE, + preserve_ref, complain); + return expr; +} + /* Helpers to build EXPR_STMT and void-cast EXPR_STMT, common ops. */ static tree @@ -2064,19 +2087,13 @@ transform_await_expr (tree await_expr, await_xform_data *xform) We no longer need a [it had diagnostic value, maybe?] We need to replace the e_proxy in the awr_call. */ - tree coro_frame_type = TREE_TYPE (xform->actor_frame); - /* If we have a frame var for the awaitable, get a reference to it. */ proxy_replace data; if (si->await_field_id) { - tree as_m -= lookup_member (coro_frame_type, si->await_field_id, - /*protect=*/1, /*want_type=*/0, tf_warning_or_error); - tree as = build_class_member_access_expr (xform->actor_frame, as_m, - NULL_TREE, true, - tf_warning_or_error); - + tree as + = coro_build_frame_access_expr (xform->actor_frame, si->await_field_id, + true, tf_warning_or_error); /* Replace references to the instance proxy with the frame entry now computed. */ data.from = TREE_OPERAND (await_expr, 1); @@ -2154,13 +2171,10 @@ transform_local_var_uses (tree *stmt, int *do_subtree, void *d) known not-used. */ if (local_var.field_id == NULL_TREE) continue; /* Wasn't used. */ - - tree fld_ref - = lookup_member (lvd->coro_frame_type, local_var.field_id, -/*protect=*/1, /*want_type=*/0, -tf_warning_or_error); - tree fld_idx = build3 (COMPONENT_REF, TREE_TYPE (lvar), -lvd->actor_frame, fld_ref, NULL_TREE); + tree fld_idx + = coro_build_frame_access_expr (lvd->actor_frame, + local_var.field_id, true, + tf_warning_or_error); local_var.field_idx = fld_idx; SET_DECL_VALUE_EXPR (lvar, fld_idx); DECL_HAS_VALUE_EXPR_P (lvar) = true; @@ -2250,12 +2264,8 @@ build_actor_fn (location_t loc, tree coro_frame_type, tree actor, tree fnbody, local_vars_transform xform_vars_data = {actor, actor_frame, coro_frame_type, loc, local_var_uses}; cp_walk_tree (&fnbody, transform_local_var_uses, &xform_vars_data, NULL); - - tree rat_field = lookup_member (coro_frame_type,
[gcc r15-3330] c: Add support for unsequenced and reproducible attributes
https://gcc.gnu.org/g:dd346b613886aea9761dbb5e7a8d6c47922750b2 commit r15-3330-gdd346b613886aea9761dbb5e7a8d6c47922750b2 Author: Jakub Jelinek Date: Sat Aug 31 15:58:23 2024 +0200 c: Add support for unsequenced and reproducible attributes C23 added in N2956 ( https://open-std.org/JTC1/SC22/WG14/www/docs/n2956.htm ) two new attributes, which are described as similar to GCC const and pure attributes, but they aren't really same and it seems that even the paper is missing some of the differences. The paper says unsequenced is the same as const on functions without pointer arguments and reproducible is the same as pure on such functions (except that they are function type attributes rather than function declaration ones), but it seems the paper doesn't consider the finiteness GCC relies on (aka non-DECL_LOOPING_CONST_OR_PURE_P) - the paper only talks about using the attributes for CSE etc., not for DCE. The following patch introduces (for now limited) support for those attributes, both as standard C23 attributes and as GNU extensions (the difference is that the patch is then less strict on where it allows them, like other function type attributes they can be specified on function declarations as well and apply to the type, while C23 standard ones must go on the function declarators (i.e. after closing paren after function parameters) or in type specifiers of function type. If function doesn't have any pointer/reference arguments, the patch adds additional internal attribute with " noptr" suffix which then is used by flags_from_decl_or_type to handle those easy cases as ECF_CONST|ECF_LOOPING_CONST_OR_PURE or ECF_PURE|ECF_LOOPING_CONST_OR_PURE The harder cases aren't handled right now, I'd hope they can be handled incrementally. I wonder whether we shouldn't emit a warning for the gcc.dg/c23-attr-{reproducible,unsequenced}-5.c cases, while the standard clearly specifies that composite types should union the attributes and it is what GCC implements for decades, for ?: that feels dangerous for the new attributes, it would be much better to be conservative on say (cond ? unsequenced_function : normal_function) (args) There is no diagnostics on incorrect [[unsequenced]] or [[reproducible]] function definitions, while I think diagnosing non-const static/TLS declarations in the former could be easy, the rest feels hard. E.g. the const/pure discovery can just punt on everything it doesn't understand, but complete diagnostics would need to understand it. 2024-08-31 Jakub Jelinek PR c/116130 gcc/ * doc/extend.texi (unsequenced, reproducible): Document new function type attributes. * calls.cc (flags_from_decl_or_type): Handle "unsequenced noptr" and "reproducible noptr" attributes. gcc/c-family/ * c-attribs.cc (c_common_gnu_attributes): Add entries for "unsequenced", "reproducible", "unsequenced noptr" and "reproducible noptr" attributes. (handle_unsequenced_attribute): New function. (handle_reproducible_attribute): Likewise. * c-common.h (handle_unsequenced_attribute): Declare. (handle_reproducible_attribute): Likewise. * c-lex.cc (c_common_has_attribute): Return 202311 for standard unsequenced and reproducible attributes. gcc/c/ * c-decl.cc (handle_std_unsequenced_attribute): New function. (handle_std_reproducible_attribute): Likewise. (std_attributes): Add entries for "unsequenced" and "reproducible" attributes. (c_warn_type_attributes): Add TYPE argument. Allow unsequenced or reproducible attributes if it is FUNCTION_TYPE. (groktypename): Adjust c_warn_type_attributes caller. (grokdeclarator): Likewise. (finish_declspecs): Likewise. * c-parser.cc (c_parser_declaration_or_fndef): Likewise. * c-tree.h (c_warn_type_attributes): Add TYPE argument. gcc/testsuite/ * c-c++-common/attr-reproducible-1.c: New test. * c-c++-common/attr-reproducible-2.c: New test. * c-c++-common/attr-unsequenced-1.c: New test. * c-c++-common/attr-unsequenced-2.c: New test. * gcc.dg/c23-attr-reproducible-1.c: New test. * gcc.dg/c23-attr-reproducible-2.c: New test. * gcc.dg/c23-attr-reproducible-3.c: New test. * gcc.dg/c23-attr-reproducible-4.c: New test. * gcc.dg/c23-attr-reproducible-5.c: New test. * gcc.dg/c23-attr-reproducible-5-aux.c: New file. * gcc.dg/c23-attr-unsequenced-1.c: New test. * gcc.dg/c23-attr-unsequenced-2.c: New test. * gcc.dg/c23-attr-unsequenced-3.c: New test.
[gcc r15-3331] c++: Add unsequenced C++ testcase
https://gcc.gnu.org/g:afd9558b94eb78ef3e9a8818f2d57f9311e99b4f commit r15-3331-gafd9558b94eb78ef3e9a8818f2d57f9311e99b4f Author: Jakub Jelinek Date: Sat Aug 31 16:03:20 2024 +0200 c++: Add unsequenced C++ testcase This is the testcase I wrote originally and which on top of the https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659154.html patch didn't behave the way I wanted (no warning and no optimizations of [[unsequenced]] function templates which don't have pointer/reference arguments. Posting this separately, because it depends on the above mentioned patch as well as the PR116175 https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659157.html patch. 2024-08-31 Jakub Jelinek * g++.dg/ext/attr-unsequenced-1.C: New test. Diff: --- gcc/testsuite/g++.dg/ext/attr-unsequenced-1.C | 53 +++ 1 file changed, 53 insertions(+) diff --git a/gcc/testsuite/g++.dg/ext/attr-unsequenced-1.C b/gcc/testsuite/g++.dg/ext/attr-unsequenced-1.C new file mode 100644 index ..8e640a8cec1e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-unsequenced-1.C @@ -0,0 +1,53 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-O2 -fdump-tree-optimized" } */ +// { dg-final { scan-tree-dump-times " bar \\\(1, 2, 3\\\);" 1 "optimized" } } +// { dg-final { scan-tree-dump-times " bar \\\(4, 5, 6\\\);" 1 "optimized" } } + +template +[[gnu::noipa]] U +foo (T x, T y, T z) [[gnu::unsequenced]] +{ + *x = 1; + *y = 2; + *z = 3; +} + +template +[[gnu::noipa]] T +bar (T x, T y, T z) [[gnu::unsequenced]] +{ + return x + y + z; +} + +int +baz () [[gnu::unsequenced]] +{ + int x, y, z; + foo (&x, &y, &z); + return x; +} + +int +qux () [[gnu::unsequenced]] +{ + int a = bar (1, 2, 3); + int b = bar (1, 2, 3); + int c = bar (1, 2, 3); + int d = bar (4, 5, 6); + int e = bar (4, 5, 6); + int f = bar (4, 5, 6); + return a + b + c + d + e + f; +} + +template +[[gnu::noipa]] U +corge (T x, T y, T z) [[gnu::unsequenced]] // { dg-warning "'unsequenced' attribute on function type without pointer arguments returning 'void'" } +{ + x += y + z; +} + +void +freddy () +{ + corge (1, 2, 3); +}
[gcc r15-3333] testsuite: Change what is being tested for pr66726-2.c
https://gcc.gnu.org/g:457805cf5969c8a9a04f0c6e626946d952163929 commit r15--g457805cf5969c8a9a04f0c6e626946d952163929 Author: Andrew Pinski Date: Fri Aug 30 09:53:01 2024 -0700 testsuite: Change what is being tested for pr66726-2.c r14-575-g6d6c17e45f62cf changed the debug dump message but the testcase pr66726-2.c was not updated for the change. The testcase was searching to make sure we didn't factor out a conversion but the testcase was no longer testing that so we needed to update what was being searched for. Tested on x86_64-linux. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr66726-2.c: Update scan dump message. Signed-off-by: Andrew Pinski Diff: --- gcc/testsuite/gcc.dg/tree-ssa/pr66726-2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr66726-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr66726-2.c index ab43d4835d2c..a59a643f5c16 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr66726-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr66726-2.c @@ -16,4 +16,4 @@ foo (char b) return a + b; } -/* { dg-final { scan-tree-dump-times "factor conversion out" 0 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "factor operation out" 0 "phiopt1" } } */
[gcc r15-3338] testsuite, c++, coroutines: Avoid 'unused' warnings [NFC].
https://gcc.gnu.org/g:7f27d1f1b94843caed557b83715a94cb5b7deb0d commit r15-3338-g7f27d1f1b94843caed557b83715a94cb5b7deb0d Author: Iain Sandoe Date: Sat Aug 31 12:53:40 2024 +0100 testsuite, c++, coroutines: Avoid 'unused' warnings [NFC]. The 'torture' section of the coroutine tests is primarily about checking correct operation of the generated code. It should, ideally, be possible to run this part of the testsuite with '-Wall' and expect no fails. In the case that we wish to test for a specific diagnostic (and that it does not appear over a range of optimisation/debug conditions) then we should make that explict (as done, for example, in pr109867.C). The tests amended here have warnings because of unused entities; in many cases those are relevant to the test, and so we just mark them with __attribute__((__unused__)). We amend the debug output in coro.h to avoid similar warnings when print output is disabled (the default). gcc/testsuite/ChangeLog: * g++.dg/coroutines/coro.h: Use a variadic macro for PRINTF to avoid unused warnings when output is disabled. * g++.dg/coroutines/torture/co-await-04-control-flow.C: Avoid unused warnings. * g++.dg/coroutines/torture/co-ret-13-template-2.C: Likewise. * g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C: Likewise. * g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C: Likewise. * g++.dg/coroutines/torture/pr109867.C: Likewise. Signed-off-by: Iain Sandoe Diff: --- gcc/testsuite/g++.dg/coroutines/coro.h| 4 ++-- gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C| 1 + gcc/testsuite/g++.dg/coroutines/torture/co-ret-13-template-2.C| 2 +- gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C | 1 - .../g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C | 4 ++-- gcc/testsuite/g++.dg/coroutines/torture/pr109867.C| 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/g++.dg/coroutines/coro.h b/gcc/testsuite/g++.dg/coroutines/coro.h index 491177f0cfd5..71c1cd73207d 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro.h +++ b/gcc/testsuite/g++.dg/coroutines/coro.h @@ -135,9 +135,9 @@ namespace coro = std; #ifndef OUTPUT # define PRINT(X) -# define PRINTF (void) +# define PRINTF(...) #else #include # define PRINT(X) puts(X) -# define PRINTF printf +# define PRINTF(...) printf(__VA_ARGS__) #endif diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C b/gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C index fd201f904816..32d9c982d4a1 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C +++ b/gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-additional-options "-Wno-unused-label" } // Check correct operation of await transform. diff --git a/gcc/testsuite/g++.dg/coroutines/torture/co-ret-13-template-2.C b/gcc/testsuite/g++.dg/coroutines/torture/co-ret-13-template-2.C index 9d4a4de8ebe8..8a8d2d6fa5d9 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/co-ret-13-template-2.C +++ b/gcc/testsuite/g++.dg/coroutines/torture/co-ret-13-template-2.C @@ -13,7 +13,7 @@ coro1 f (T y) noexcept { PRINT ("coro1: about to return"); - T x = y; + __attribute__((__unused__)) T x = y; co_return 3; } diff --git a/gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C b/gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C index 6433b62109fc..c5a0a38b2ca2 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C +++ b/gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C @@ -116,7 +116,6 @@ struct coro1 { struct coro1 n4849_ia_thrower (int k) { - int caught = 0; PRINT ("f: about to return 22"); co_return 22; } diff --git a/gcc/testsuite/g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C b/gcc/testsuite/g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C index 419eb6b64673..04c1ab362d2d 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C +++ b/gcc/testsuite/g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C @@ -13,9 +13,9 @@ f (int start) noexcept { int value = start; { -int value = start + 5; +__attribute__((__unused__)) int value = start + 5; { - int value = start + 20; + __attribute__((__unused__)) int value = start + 20; } { int value = start + 1; diff --git a/gcc/testsuite/g++.dg/coroutines/torture/pr109867.C b/gcc/testsuite/g++.dg/coroutines/torture/pr109867.C index d4663771ea40..8c90cf85ebb8 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/pr109867.C +++ b/gcc/testsuite/g++.
[gcc r15-3334] phiopt: Ignore some nop statements in heursics [PR116098]
https://gcc.gnu.org/g:ceda727dafba6e05b510b5f8f4ccacfb507dc023 commit r15-3334-gceda727dafba6e05b510b5f8f4ccacfb507dc023 Author: Andrew Pinski Date: Fri Aug 30 10:36:24 2024 -0700 phiopt: Ignore some nop statements in heursics [PR116098] The heurstics that was added for PR71016, try to search to see if the conversion was being moved away from its definition. The problem is the heurstics would stop if there was a non GIMPLE_ASSIGN (and already ignores debug statements) and in this case we would have a GIMPLE_LABEL that was not being ignored. So we should need to ignore GIMPLE_NOP, GIMPLE_LABEL and GIMPLE_PREDICT. Note this is now similar to how gimple_empty_block_p behaves. Note this fixes the wrong code that was reported by moving the VCE (conversion) out before the phiopt/match could convert it into an bit_ior and move the VCE out with the VCE being conditionally valid. Bootstrapped and tested on x86_64-linux-gnu. Also built and tested for aarch64-linux-gnu. PR tree-optimization/116098 gcc/ChangeLog: * tree-ssa-phiopt.cc (factor_out_conditional_operation): Ignore nops, labels and predicts for heuristic for conversion with a constant. gcc/testsuite/ChangeLog: * c-c++-common/torture/pr116098-1.c: New test. * gcc.target/aarch64/csel-1.c: New test. Signed-off-by: Andrew Pinski Diff: --- gcc/testsuite/c-c++-common/torture/pr116098-1.c | 84 + gcc/testsuite/gcc.target/aarch64/csel-1.c | 28 + gcc/tree-ssa-phiopt.cc | 9 ++- 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/c-c++-common/torture/pr116098-1.c b/gcc/testsuite/c-c++-common/torture/pr116098-1.c new file mode 100644 index ..b9d9a3423059 --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr116098-1.c @@ -0,0 +1,84 @@ +/* { dg-do run } */ +/* PR tree-optimization/116098 */ +/* truthy was being miscompiled where the VCE was not being pulled out + of the if statement by factor_out_conditional_operation before the rest of + phiopt would happen which assumed VCE would be correct. */ +/* The unused label was causing truthy to have different code generation than truthy_1. */ + + +#ifndef __cplusplus +#define bool _Bool +#endif + +enum ValueType { +VALUE_BOOLEAN, +VALUE_NUM, +}; + +struct Value { +enum ValueType type; +union { +bool boolean; +int num; +}; +}; + +static struct Value s_value; +static bool s_b; + + +bool truthy_1(void) __attribute__((noinline)); +bool +truthy_1(void) +{ +struct Value value = s_value; +if (s_b) s_b = 0; +enum ValueType t = value.type; +if (t != VALUE_BOOLEAN) + return 1; + return value.boolean; +} +bool truthy(void) __attribute__((noinline)); +bool +truthy(void) +{ +struct Value value = s_value; +if (s_b) s_b = 0; +enum ValueType t = value.type; +if (t != VALUE_BOOLEAN) + return 1; + /* This unused label should not cause any difference in code generation. */ +a: __attribute__((unused)); + return value.boolean; +} + +int +main(void) +{ +s_b = 0; +s_value = (struct Value) { +.type = VALUE_NUM, +.num = 2, +}; +s_value = (struct Value) { +.type = VALUE_BOOLEAN, +.boolean = !truthy_1(), +}; +bool b = truthy_1(); +if (b) + __builtin_abort(); + +s_b = 0; +s_value = (struct Value) { +.type = VALUE_NUM, +.num = 2, +}; +s_value = (struct Value) { +.type = VALUE_BOOLEAN, +.boolean = !truthy(), +}; +b = truthy(); +if (b) + __builtin_abort(); +} + diff --git a/gcc/testsuite/gcc.target/aarch64/csel-1.c b/gcc/testsuite/gcc.target/aarch64/csel-1.c new file mode 100644 index ..a20d39ea3758 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/csel-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* These 2 functions should be the same; even though there is a label in f1. + The label should not make a difference in code generation. + There sign extend should be removed as it is not needed. */ +void f(int t, int a, short *b) +{ + short t1 = 1; + if (a) +{ + t1 = t; +} + *b = t1; +} + +void f1(int t, int a, short *b) +{ + short t1 = 1; + if (a) +{ + label1: __attribute__((unused)) + t1 = t; +} + *b = t1; +} + +/* { dg-final { scan-assembler-not "sxth\t" } } */ diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 9a009e187ee9..271a5d51f09f 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -324,8 +324,13 @@ factor_out_conditional_operation (edge e0, edge e1, gphi *phi, gsi_prev_nondebug (&gsi); if (!gsi_end_p (gsi)) { - if (gassign *assign -
[gcc r15-3329] AVR: Don't print a space after , when printing instructions.
https://gcc.gnu.org/g:dc476e5f68ecc5acaf93677ce57b74bd01ce2d13 commit r15-3329-gdc476e5f68ecc5acaf93677ce57b74bd01ce2d13 Author: Georg-Johann Lay Date: Sat Aug 31 10:58:12 2024 +0200 AVR: Don't print a space after , when printing instructions. gcc/ * config/avr/avr.cc: Follow the convention to not add a space after comma when printing instructions. Diff: --- gcc/config/avr/avr.cc | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index 614b361921a2..079db62695dc 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -4184,7 +4184,7 @@ avr_out_movsi_mr_r_reg_no_disp_tiny (rtx_insn *insn, rtx op[], int *l) /* "ld r26,-X" is undefined */ if (reg_unused_after (insn, base)) { - return *l = 7, ("mov __tmp_reg__, %B1" CR_TAB + return *l = 7, ("mov __tmp_reg__,%B1" CR_TAB "st %0,%A1" CR_TAB TINY_ADIW (%E0, %F0, 1) CR_TAB "st %0+,__tmp_reg__"CR_TAB @@ -4193,7 +4193,7 @@ avr_out_movsi_mr_r_reg_no_disp_tiny (rtx_insn *insn, rtx op[], int *l) } else { - return *l = 9, ("mov __tmp_reg__, %B1" CR_TAB + return *l = 9, ("mov __tmp_reg__,%B1" CR_TAB "st %0,%A1" CR_TAB TINY_ADIW (%E0, %F0, 1) CR_TAB "st %0+,__tmp_reg__"CR_TAB @@ -4291,7 +4291,7 @@ out_movsi_mr_r (rtx_insn *insn, rtx op[], int *l) { if (io_address_operand (base, SImode)) { - return *l=4,("out %i0, %A1" CR_TAB + return *l=4,("out %i0,%A1" CR_TAB "out %i0+1,%B1" CR_TAB "out %i0+2,%C1" CR_TAB "out %i0+3,%D1"); @@ -8230,7 +8230,7 @@ avr_out_plus_set_ZN (rtx *xop, int *plen) && IN_RANGE (INTVAL (xval), 1, 63)) { // Add 16-bit value in [1..63] to a w register. - return avr_asm_len ("adiw %0, %1", xop, plen, 1); + return avr_asm_len ("adiw %0,%1", xop, plen, 1); } // Addition won't work; subtract the negative of XVAL instead. @@ -8259,7 +8259,7 @@ avr_out_plus_set_ZN (rtx *xop, int *plen) if (IN_RANGE (INTVAL (op[1]), 0, 63)) { // SBIW can handle the lower 16 bits. - avr_asm_len ("sbiw %0, %1", op, plen, 1); + avr_asm_len ("sbiw %0,%1", op, plen, 1); // Next byte has already been handled: Skip it. ++i; @@ -8273,8 +8273,8 @@ avr_out_plus_set_ZN (rtx *xop, int *plen) { // d-regs can subtract immediates. avr_asm_len (i == 0 - ? "subi %0, %1" - : "sbci %0, %1", op, plen, 1); + ? "subi %0,%1" + : "sbci %0,%1", op, plen, 1); } else { @@ -8283,8 +8283,8 @@ avr_out_plus_set_ZN (rtx *xop, int *plen) { // Any register can subtract 0. avr_asm_len (i == 0 - ? "sub %0, __zero_reg__" - : "sbc %0, __zero_reg__", op, plen, 1); + ? "sub %0,__zero_reg__" + : "sbc %0,__zero_reg__", op, plen, 1); } else { @@ -8294,13 +8294,13 @@ avr_out_plus_set_ZN (rtx *xop, int *plen) { // Load partial xval to QI clobber reg and memoize for later. gcc_assert (REG_P (op[2])); - avr_asm_len ("ldi %2, %1", op, plen, 1); + avr_asm_len ("ldi %2,%1", op, plen, 1); clobber_val = val8; } avr_asm_len (i == 0 - ? "sub %0, %2" - : "sbc %0, %2", op, plen, 1); + ? "sub %0,%2" + : "sbc %0,%2", op, plen, 1); } } } // Loop bytes.
[gcc r15-3332] Fortran: downgrade use associated namelist group name to legacy extension
https://gcc.gnu.org/g:79b5b50402454dd1c217c8e2e21ce85aa35e4f1b commit r15-3332-g79b5b50402454dd1c217c8e2e21ce85aa35e4f1b Author: Harald Anlauf Date: Fri Aug 30 21:15:43 2024 +0200 Fortran: downgrade use associated namelist group name to legacy extension The Fortran standard disallows use associated names as namelist group name (e.g. F2003:C581, but also later standards). This feature is a gfortran legacy extension, and we should give a warning even for -std=gnu. gcc/fortran/ChangeLog: * match.cc (gfc_match_namelist): Downgrade feature from GNU to legacy extension. gcc/testsuite/ChangeLog: * gfortran.dg/pr88169_3.f90: Adjust pattern. Diff: --- gcc/fortran/match.cc| 4 +++- gcc/testsuite/gfortran.dg/pr88169_3.f90 | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc index d30a98f48fa8..53c54c1c4899 100644 --- a/gcc/fortran/match.cc +++ b/gcc/fortran/match.cc @@ -5603,9 +5603,11 @@ gfc_match_namelist (void) return MATCH_ERROR; } + /* A use associated name shall not be used as a namelist group name +(e.g. F2003:C581). It is only supported as a legacy extension. */ if (group_name->attr.flavor == FL_NAMELIST && group_name->attr.use_assoc - && !gfc_notify_std (GFC_STD_GNU, "Namelist group name %qs " + && !gfc_notify_std (GFC_STD_LEGACY, "Namelist group name %qs " "at %C already is USE associated and can" "not be respecified.", group_name->name)) return MATCH_ERROR; diff --git a/gcc/testsuite/gfortran.dg/pr88169_3.f90 b/gcc/testsuite/gfortran.dg/pr88169_3.f90 index 6bc24ed6b719..49ef430e6640 100644 --- a/gcc/testsuite/gfortran.dg/pr88169_3.f90 +++ b/gcc/testsuite/gfortran.dg/pr88169_3.f90 @@ -10,6 +10,5 @@ program main use foo_nml, only: bar => foo, x implicit none real a - namelist /bar/a ! { dg-error "already is USE associated" } + namelist /bar/a ! { dg-error "Legacy Extension: .* already is USE associated" } end program -! { dg-final { cleanup-modules "foo_nml" } }
[gcc r15-3340] AVR: Run pass avr-fuse-add a second time after pass_cprop_hardreg.
https://gcc.gnu.org/g:df89afbb7732bdf9f003af0020a46b6deb3c4eeb commit r15-3340-gdf89afbb7732bdf9f003af0020a46b6deb3c4eeb Author: Georg-Johann Lay Date: Fri Aug 30 19:38:30 2024 +0200 AVR: Run pass avr-fuse-add a second time after pass_cprop_hardreg. gcc/ * config/avr/avr-passes.cc (avr_pass_fuse_add) : Override. * config/avr/avr-passes.def (avr_pass_fuse_add): Run again after pass_cprop_hardreg. Diff: --- gcc/config/avr/avr-passes.cc | 7 +++ gcc/config/avr/avr-passes.def | 21 + 2 files changed, 28 insertions(+) diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc index 58b132b64bec..8a71b57ada10 100644 --- a/gcc/config/avr/avr-passes.cc +++ b/gcc/config/avr/avr-passes.cc @@ -1026,6 +1026,13 @@ public: this->name = name; } + // Cloning is required because we are running one instance of the pass + // before peephole2. and a second one after cprop_hardreg. + opt_pass * clone () final override + { +return make_avr_pass_fuse_add (m_ctxt); + } + bool gate (function *) final override { return optimize && avr_fuse_add > 0; diff --git a/gcc/config/avr/avr-passes.def b/gcc/config/avr/avr-passes.def index 3be82e027101..cd89d6737276 100644 --- a/gcc/config/avr/avr-passes.def +++ b/gcc/config/avr/avr-passes.def @@ -26,6 +26,27 @@ INSERT_PASS_BEFORE (pass_peephole2, 1, avr_pass_fuse_add); +/* There are cases where avr-fuse-add doesn't find POST_INC cases because + the RTL code at that time is too long-winded, and moves registers back and + forth (which seems to be the same reason for why pass auto_inc_dec cannot + find POST_INC, either). Some of that long-windedness is cleaned up very + late in pass cprop_hardreg, which opens up new opportunities to find post + increments. An example is the following function from AVR-LibC's qsort: + + void swapfunc (char *a, char *b, int n) + { + do + { + char tmp = *a; + *a++ = *b; + *b++ = tmp; + } while (--n > 0); + } + + Hence, run avr-fuse-add twice; the second time after cprop_hardreg. */ + +INSERT_PASS_AFTER (pass_cprop_hardreg, 1, avr_pass_fuse_add); + /* An analysis pass that runs prior to prologue / epilogue generation. Computes cfun->machine->gasisr.maybe which is used in prologue and epilogue generation provided -mgas-isr-prologues is on. */
[gcc/aoliva/heads/testbase] (185 commits) Optimize initialization of small padded objects
The branch 'aoliva/heads/testbase' was updated to point to: 673a448aa24e... Optimize initialization of small padded objects It previously pointed to: 3ff1b91e7729... Daily bump. Diff: Summary of changes (added commits): --- 673a448... Optimize initialization of small padded objects (*) 08693e2... Daily bump. (*) b1765a5... c++: add fixed test [PR101099] (*) ffd56dc... c++: add fixed test [PR115616] (*) f93a38f... c++: fix used but not defined warning for friend (*) b222122... Fortran: default-initialization of derived-type function re (*) 5020f8e... gdbhooks: Fix printing of vec with vl_ptr layout (*) 3fb9072... Don't remove /usr/lib and /lib from when passing to the lin (*) 4d2cbe2... middle-end: Remove integer_three_node [PR116537] (*) 04d11de... expand: Small speed up expansion of __builtin_prefetch (*) 87ce817... PR modula2/116181: m2rts fix -Wodr warning (*) d48273f... Avoid division by zero via constant_multiple_p (*) e7c7397... Do not bother with reassociation in SLP discovery for singl (*) b748e2e... c++: Allow standard attributes after closing square bracket (*) ab214ef... Check avx upper register for parallel. (*) 350d627... Daily bump. (*) aff7f67... SARIF output: implement embedded URLs in messages (§3.11.6 (*) e31b617... pretty-print: reimplement pp_format with a new struct pp_to (*) 68a0ca6... pretty-print: move class chunk_info into its own header (*) 464a3d2... Use std::unique_ptr for optinfo_item (*) 6bfeba1... Fortran: fix ICE with use with rename of namelist member [P (*) 81c4798... hppa: Fix handling of unscaled index addresses on HP-UX (*) 215c7e3... expand: Allow widdening optab when expanding popcount==1 [P (*) cdd5dd2... ada: Fix assertion failure on private limited with clause (*) d506247... ada: Fix internal error on concatenation of discriminant-de (*) a50584b... ada: Missing legality check when type completed (*) 4994069... ada: Fix missing finalization for call to function returnin (*) c2e3326... ada: Print Insertion_Sloc in dmsg (*) bb7a166... ada: Use the same warning character in continuation message (*) ad4c549... ada: Restructure continuation message for pretty printing (*) f60b53c... ada: Improve Inspection_Point warning (*) 4825bbf... ada: Avoid creating continuation messages without an intend (*) f872bba... ada: Parse the attributes of continuation messages correctl (*) 446f415... ada: Use consistent type continuations messages (*) dbaf2c0... ada: Extract line fitting algorithm (*) 299cd64... ada: Ensure validity checks for private scalar types (*) 6a3ff84... ada: Display actual line length in line length check (*) a383d7b... ada: Proper handling for iterator associations in array agg (*) 567e36c... ada: First controlling parameter aspect (*) 6b4b5b4... ada: Update documentation for conditional when constructs (*) ac6d433... Allow subregs around constant displacements [PR116516] (*) 00ec6bd... Make some smallest_int_mode_for_size calls cope with failur (*) 07e5e05... AVR: target/115830 - Make better use of SREG.N and SREG.Z. (*) d9c54e9... c++: don't remove labels during coro-early-expand-ifns [PR1 (*) bd2ccc2... AVR: Outsource code for avr-specific passes to new avr-pass (*) 4b729d2... testsuite: Fix up refactored scanltranstree.exp functions [ (*) 4ff4875... RISC-V: Fix subreg of VLS modes larger than a vector [PR116 (*) 3cb92be... i386: Support wide immediate constants in STV. (*) 155da08... Write LF_MFUNC_ID types for CodeView struct member function (*) c5043d8... Record member functions in CodeView struct definitions (*) 6a9932e... Record static data members in CodeView structs (*) 310fd68... Handle scoping in CodeView LF_FUNC_ID types (*) 3501226... Handle namespaced names for CodeView (*) 6cd806a... Daily bump. (*) 9f79c7d... c++: wrong error due to std::initializer_list opt [PR116476 (*) b8ef805... PR modula2/116181 remove ODR warnings from library interfac (*) 3c89c41... expand: Add debug dump on the cost for `popcount==1` expand (*) b68561d... libstdc++: Fix autoconf check for O_NONBLOCK in (*) 51b0fef... libstdc++: Fix -Wunused-parameter warnings in Networking TS (*) 0e2b3db... libstdc++: Fix -Wunused-variable warning in (*) a59f1cc... libstdc++: Remove unused typedef in (*) 9740a1b... doc: Add Dhruv Matani to Contributors (*) c2ad7b2... libstdc++: Fix @file for target-specific opt_random.h (*) f6ed7a6... libstdc++: Fix @headername for bits/cpp_type_traits.h (*) 898f013... AVR: Overhaul the avr-ifelse RTL optimization pass. (*) 6661944... Add gcc ka.po (*) 15f857a... c++: ICE with ()-init and TARGET_EXPR eliding [PR116424] (*) abeecce... aarch64: Assume zero gather/scatter set-up cost for -mtune= (*) 3e27ea2... aarch64: Fix gather x32/x64 selection (*) 035c196... aarch64: Add a test for zeroing <64bits>x2_t structures (*) 3c9338b... Tweak documentation of ASM_INPUT_P (*) bdcd
[gcc r15-3344] testsuite: Prune compilation messages for modules tests
https://gcc.gnu.org/g:f22788c7c01ebb4fefffc1162eb85ffb7a82c314 commit r15-3344-gf22788c7c01ebb4fefffc1162eb85ffb7a82c314 Author: Hans-Peter Nilsson Date: Sun Aug 18 07:01:06 2024 +0200 testsuite: Prune compilation messages for modules tests All testsuite compiler-calls pass default_target_compile in the dejagnu installation (typically /usr/share/dejagnu/target.exp) which also calls the dejagnu-installed prune_warnings. Normally, tests using the dg framework (most or all tests these days) compile and link by calling various wrappers that end up calling dg-test in the dejagnu installation, typically installed as /usr/share/dejagnu/dg.exp. That, besides the compiler call, also calls ${tool}-dg-prune (g++-dg-prune) on the messages, which in turn ends up calling prune_gcc_output in gcc/testsuite/lib/prune.exp. That gcc-specific "pruning" function handles more cases than the dejagnu prune_warnings, and also has updated patterns. But, module_do_it in modules.exp calls the lower-level ${tool}_target_compile "directly", i.e. g++_target_compile defined in gcc/testsuite/lib/g++.exp. That does not call ${tool}-dg-prune, meaning those test-cases miss the gcc-specific pruning. Noticed while testing a dejagnu update that handled the miniscule "in" in the warning (line-breaks added below besides the original one after "(void*)':") "/path/to/cris-elf/bin/ld: /gccobj/cris-elf/./libstdc++-v3/src/.libs/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)': /gccsrc/libstdc++-v3/src/c++11/random.cc:183: warning: _getentropy is not implemented and will always fail" The line saying "in function" rather than "In function" (from the binutils linker since 2018) is pruned by prune_gcc_output. The prune_warnings in dejagnu-1.6.3 and earlier handles the second line separately. It's an unfortunate wart that neither consumes the delimiting line-break, leaving to the callers to prune residual empty lines. See prune_warnings in dejagnu (default_target_compile and dg-test) for those other line-break fixups, as alluded in the comment. * g++.dg/modules/modules.exp (module_do_it): Prune compilation messages. Diff: --- gcc/testsuite/g++.dg/modules/modules.exp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index 3e8df9b89309..e6bf28d8b1a0 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -205,9 +205,19 @@ proc module_do_it { do_what testcase std asm_list } { if { !$ok } { unresolved "$ident link" } else { + global target_triplet set out [${tool}_target_compile $asm_list \ $execname executable $options] eval $xfail + + # Do gcc-specific pruning. + set out [${tool}-dg-prune $target_triplet $out] + # Fix up remaining line-breaks similar to "regular" pruning + # calls. Otherwise, a multi-line message stripped e.g. one + # part by the default prune_warnings and one part part by the + # gcc prune_gcc_output will have a residual line-break. + regsub "^\[\r\n\]+" $out "" out + if { $out == "" } { pass "$ident link" } else {
[gcc r15-3328] Optimize initialization of small padded objects
https://gcc.gnu.org/g:673a448aa24efedd5ac140ebf7bfe652d7a6a846 commit r15-3328-g673a448aa24efedd5ac140ebf7bfe652d7a6a846 Author: Alexandre Oliva Date: Sat Aug 31 06:03:12 2024 -0300 Optimize initialization of small padded objects When small objects containing padding bits (or bytes) are fully initialized, we will often store them in registers, and setting bitfields and other small fields will attempt to preserve the uninitialized padding bits, which tends to be expensive. Zero-initializing registers, OTOH, tends to be cheap. So, if we're optimizing, zero-initialize such small padded objects even if that's not needed for correctness. We can't zero-initialize all such padding objects, though: if there's no padding whatsoever, and all fields are initialized with nonzero, the zero initialization would be flagged as dead. That's why we introduce machinery to detect whether objects have padding bits. I considered distinguishing between bitfields, units and larger padding elements, but I didn't pursue that distinction. Since the object's zero-initialization subsumes fields' zero-initialization, the empty string test in builtin-snprintf-6.c's test_assign_aggregate would regress without the addition of native_encode_constructor. for gcc/ChangeLog * expr.cc (categorize_ctor_elements_1): Change p_complete to int, to distinguish complete initialization in presence or absence of uninitialized padding bits. (categorize_ctor_elements): Likewise. Adjust all callers... * expr.h (categorize_ctor_elements): ... and declaration. (type_has_padding_at_level_p): New. * gimple-fold.cc (type_has_padding_at_level_p): New. * fold-const.cc (native_encode_constructor): New. (native_encode_expr): Call it. * gimplify.cc (gimplify_init_constructor): Clear small non-addressable non-volatile objects with padding or other uninitialized fields as an optimization. for gcc/testsuite/ChangeLog * gcc.dg/init-pad-1.c: New. Diff: --- gcc/expr.cc | 20 ++-- gcc/expr.h| 3 ++- gcc/fold-const.cc | 36 gcc/gimple-fold.cc| 50 +++ gcc/gimplify.cc | 14 ++- gcc/testsuite/gcc.dg/init-pad-1.c | 18 ++ 6 files changed, 132 insertions(+), 9 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index 8d17a5a39b4b..320be8b17a13 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7096,7 +7096,7 @@ count_type_elements (const_tree type, bool for_ctor_p) static bool categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts, HOST_WIDE_INT *p_unique_nz_elts, - HOST_WIDE_INT *p_init_elts, bool *p_complete) + HOST_WIDE_INT *p_init_elts, int *p_complete) { unsigned HOST_WIDE_INT idx; HOST_WIDE_INT nz_elts, unique_nz_elts, init_elts, num_fields; @@ -7218,7 +7218,10 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts, if (*p_complete && !complete_ctor_at_level_p (TREE_TYPE (ctor), num_fields, elt_type)) -*p_complete = false; +*p_complete = 0; + else if (*p_complete > 0 + && type_has_padding_at_level_p (TREE_TYPE (ctor))) +*p_complete = -1; *p_nz_elts += nz_elts; *p_unique_nz_elts += unique_nz_elts; @@ -7239,7 +7242,10 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts, and place it in *P_ELT_COUNT. * whether the constructor is complete -- in the sense that every meaningful byte is explicitly given a value -- - and place it in *P_COMPLETE. + and place it in *P_COMPLETE: + - 0 if any field is missing + - 1 if all fields are initialized, and there's no padding + - -1 if all fields are initialized, but there's padding Return whether or not CTOR is a valid static constant initializer, the same as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */ @@ -7247,12 +7253,12 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts, bool categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts, HOST_WIDE_INT *p_unique_nz_elts, - HOST_WIDE_INT *p_init_elts, bool *p_complete) + HOST_WIDE_INT *p_init_elts, int *p_complete) { *p_nz_elts = 0; *p_unique_nz_elts = 0; *p_init_elts = 0; - *p_complete = true; + *p_complete = 1; return categorize_ctor_elements_1 (ctor, p_nz_elts, p_unique_nz_elts, p_init_elts, p_complete); @@ -7313,7 +7319,7 @@ mostly_zeros_p (const_tree exp) if (TR
[gcc r15-3337] testsuite, c++, coroutines: Correct a test intent.
https://gcc.gnu.org/g:2c27189da4de8a4ba005255fd3df6f3ac7064498 commit r15-3337-g2c27189da4de8a4ba005255fd3df6f3ac7064498 Author: Iain Sandoe Date: Sat Aug 31 12:42:36 2024 +0100 testsuite, c++, coroutines: Correct a test intent. The intention of the series of tests numberef pr95615-* is to verify that entities created by the ramp and potentially needing destruction are correctly handled when exceptions are thrown. Because of a typo, one case was not being checked correctly (the return object). This patch amends the check to test that the returned object is properly deleted. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/pr95615.inc: Check tha the task object produced by get_return_object is correctly deleted on exception. Signed-off-by: Iain Sandoe Diff: --- gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc b/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc index 5fc22430e991..b6f78fb15b9f 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc +++ b/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc @@ -12,11 +12,11 @@ namespace std { bool frame_live = false; bool promise_live = false; -bool gro_live = false; struct X {}; int Y_live = 0; +int task_live = 0; struct Y { @@ -85,7 +85,6 @@ struct task { #if GET_RETURN_OBJECT_THROWS throw X{}; #endif - bool gro_live = true; return task{}; } @@ -96,12 +95,12 @@ struct task { } }; -task() { std::puts("task()"); } -~task() { std::puts("~task()"); } -task(task&&) { std::puts("task(task&&)"); } +task() { std::puts("task()"); task_live++; } +~task() { std::puts("~task()"); task_live--; } +task(task&&) { std::puts("task(task&&)"); task_live++; } }; -task f(Y Val) { +task f(Y Val __attribute__((__unused__))) { co_return; } @@ -112,8 +111,8 @@ int main() { f(Val); } catch (X) { std::puts("caught X"); -if (gro_live) - std::puts("gro live"), failed = true; +if (task_live) + std::puts("task live"), failed = true; if (promise_live) std::puts("promise live"), failed = true; if (frame_live)
[gcc r15-3335] hppa: Enable PA 2.0 symbolic operands on ELF32 targets
https://gcc.gnu.org/g:b7e9f361088055c49cee8225a6cc0f4288458211 commit r15-3335-gb7e9f361088055c49cee8225a6cc0f4288458211 Author: John David Anglin Date: Sat Aug 31 12:20:14 2024 -0400 hppa: Enable PA 2.0 symbolic operands on ELF32 targets The GNU ELF32 linker has been fixed and it can now handle PA 2.0 symbolic relocations. This only affects non-pic code generation. 2024-08-31 John David Anglin gcc/ChangeLog: * config/pa/pa.cc (pa_emit_move_sequence): Remove symbolic memory work arounds for TARGET_ELF32. (pa_legitimate_address_p): Likewise. Allow symbolic operands. Adjust comment. * config/pa/pa.md: Replace reg_or_0_or_nonsymb_mem_operand with reg_or_0_or_mem_operand predicate in various unnamed move insns. * config/pa/predicates.md (floating_point_store_memory_operand): Update comment. Remove symbolic memory work arounds for TARGET_ELF32. (nonsymb_mem_operand): Rename to mem_operand. Allow symbolic memory operands. (reg_or_0_or_nonsymb_mem_operand): Rename to reg_or_0_or_mem_operand. Allow symbolic memory operands. Diff: --- gcc/config/pa/pa.cc | 13 ++--- gcc/config/pa/pa.md | 12 ++-- gcc/config/pa/predicates.md | 27 +-- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index 297ec3a6f69b..631f18a0ef51 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -2043,8 +2043,7 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg) op1 = replace_equiv_address (op1, scratch_reg); } } - else if (((TARGET_ELF32 || !TARGET_PA_20) - && symbolic_memory_operand (op1, VOIDmode)) + else if ((!INT14_OK_STRICT && symbolic_memory_operand (op1, VOIDmode)) || IS_LO_SUM_DLT_ADDR_P (XEXP (op1, 0)) || IS_INDEX_ADDR_P (XEXP (op1, 0))) { @@ -2093,8 +2092,7 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg) op0 = replace_equiv_address (op0, scratch_reg); } } - else if (((TARGET_ELF32 || !TARGET_PA_20) - && symbolic_memory_operand (op0, VOIDmode)) + else if ((!INT14_OK_STRICT && symbolic_memory_operand (op0, VOIDmode)) || IS_LO_SUM_DLT_ADDR_P (XEXP (op0, 0)) || IS_INDEX_ADDR_P (XEXP (op0, 0))) { @@ -11059,20 +11057,21 @@ pa_legitimate_address_p (machine_mode mode, rtx x, bool strict, code_helper) { y = XEXP (x, 1); - /* Needed for -fPIC */ + /* UNSPEC_DLTIND14R is always okay. Needed for -fPIC */ if (mode == Pmode && GET_CODE (y) == UNSPEC) return true; /* Before reload, we need support for 14-bit floating point loads and stores, and associated relocations. */ - if ((TARGET_ELF32 || !INT14_OK_STRICT) + if (!INT14_OK_STRICT && !reload_completed && mode != QImode && mode != HImode) return false; - if (CONSTANT_P (y)) + if (CONSTANT_P (y) + || (!flag_pic && symbolic_operand (y, mode))) return true; } return false; diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 9e410f43052d..1e781efb66b0 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -3866,7 +3866,7 @@ (define_insn "" [(set (match_operand:DF 0 "move_dest_operand" "=f,*r,T,?o,?Q,f,*r,*r,?*r,?f") - (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand" + (match_operand:DF 1 "reg_or_0_or_mem_operand" "fG,*rG,f,*r,*r,RT,o,RQ,f,*r"))] "(register_operand (operands[0], DFmode) || reg_or_0_operand (operands[1], DFmode)) @@ -4040,7 +4040,7 @@ (define_insn "" [(set (match_operand:DF 0 "move_dest_operand" "=r,?o,?Q,r,r") - (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand" + (match_operand:DF 1 "reg_or_0_or_mem_operand" "rG,r,r,o,RQ"))] "(register_operand (operands[0], DFmode) || reg_or_0_operand (operands[1], DFmode)) @@ -4440,7 +4440,7 @@ (define_insn "" [(set (match_operand:SF 0 "move_dest_operand" "=f,!*r,f,*r,T,Q,?*r,?f") - (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand" + (match_operand:SF 1 "reg_or_0_or_mem_operand" "fG,!*rG,RT,RQ,f,*rG,f,*r"))] "(register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode)) @@ -4462,7 +4462,7 @@ (define_insn "" [(set (match_operand:SF 0 "move_dest_operand" "=f,!*r,f,*r,T,Q") - (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand" +
[gcc r15-3341] libobjc: Add cast to void* to disable warning for casting between incompatible function types [PR895
https://gcc.gnu.org/g:2ac27bd50388d90a430357ce2d36f306cbe10128 commit r15-3341-g2ac27bd50388d90a430357ce2d36f306cbe10128 Author: Andrew Pinski Date: Sat Aug 31 11:57:32 2024 -0700 libobjc: Add cast to void* to disable warning for casting between incompatible function types [PR89586] Even though __objc_get_forward_imp returns an IMP type, it will be casted to a compatable function type before calling it. So we adding a cast to `void*` will disable warning about the incompatible type. Pushed after bootstrap/test on x86_64. libobjc/ChangeLog: PR libobjc/89586 * sendmsg.c (__objc_get_forward_imp): Add cast to `void*` before casting to IMP. Signed-off-by: Andrew Pinski Diff: --- libobjc/sendmsg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c index e781b2a9e505..65bc250ad90c 100644 --- a/libobjc/sendmsg.c +++ b/libobjc/sendmsg.c @@ -126,11 +126,11 @@ __objc_get_forward_imp (id rcv, SEL sel) && objc_sizeof_type (t) > OBJC_MAX_STRUCT_BY_VALUE #endif ) -return (IMP)__objc_block_forward; +return (IMP)(void*)__objc_block_forward; else if (t && (*t == 'f' || *t == 'd')) -return (IMP)__objc_double_forward; +return (IMP)(void*)__objc_double_forward; else -return (IMP)__objc_word_forward; +return (IMP)(void*)__objc_word_forward; } }
[gcc r15-3339] AVR: Tidy pass avr-fuse-add.
https://gcc.gnu.org/g:60fc5501ddc77d496f1584532c29d209eea13734 commit r15-3339-g60fc5501ddc77d496f1584532c29d209eea13734 Author: Georg-Johann Lay Date: Fri Aug 30 19:38:30 2024 +0200 AVR: Tidy pass avr-fuse-add. gcc/ * config/avr/avr-protos.h (avr_split_tiny_move): Rename to avr_split_fake_addressing_move. * config/avr/avr-passes.def: Same. * config/avr/avr-passes.cc: Same. (avr_pass_data_fuse_add) : Set to TV_MACH_DEP. * config/avr/avr.md (split-lpmx): Remove a define_split. Such splits are performed by avr_split_fake_addressing_move. Diff: --- gcc/config/avr/avr-passes.cc | 8 gcc/config/avr/avr-passes.def | 10 +- gcc/config/avr/avr-protos.h | 2 +- gcc/config/avr/avr.md | 35 ++- 4 files changed, 12 insertions(+), 43 deletions(-) diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc index 8b018ff6a056..58b132b64bec 100644 --- a/gcc/config/avr/avr-passes.cc +++ b/gcc/config/avr/avr-passes.cc @@ -1009,7 +1009,7 @@ static const pass_data avr_pass_data_fuse_add = RTL_PASS,// type "", // name (will be patched) OPTGROUP_NONE,// optinfo_flags - TV_DF_SCAN, // tv_id + TV_MACH_DEP, // tv_id 0, // properties_required 0, // properties_provided 0, // properties_destroyed @@ -1503,8 +1503,8 @@ avr_pass_fuse_add::fuse_mem_add (Mem_Insn &mem, Add_Insn &add) - PLUS insn of that kind. - Indirect loads and stores. In almost all cases, combine opportunities arise from the preparation - done by `avr_split_tiny_move', but in some rare cases combinations are - found for the ordinary cores, too. + done by `avr_split_fake_addressing_move', but in some rare cases combinations + are found for the ordinary cores, too. As we consider at most one Mem insn per try, there may still be missed optimizations like POST_INC + PLUS + POST_INC might be performed as PRE_DEC + PRE_DEC for two adjacent locations. */ @@ -1714,7 +1714,7 @@ public: core's capabilities. This sets the stage for pass .avr-fuse-add. */ bool -avr_split_tiny_move (rtx_insn * /*insn*/, rtx *xop) +avr_split_fake_addressing_move (rtx_insn * /*insn*/, rtx *xop) { bool store_p = false; rtx mem, reg_or_0; diff --git a/gcc/config/avr/avr-passes.def b/gcc/config/avr/avr-passes.def index 748260edaef6..3be82e027101 100644 --- a/gcc/config/avr/avr-passes.def +++ b/gcc/config/avr/avr-passes.def @@ -20,9 +20,9 @@ /* A post reload optimization pass that fuses PLUS insns with CONST_INT addend with a load or store insn to get POST_INC or PRE_DEC addressing. It can also fuse two PLUSes to a single one, which may occur due to - splits from `avr_split_tiny_move'. We do this in an own pass because - it can find more cases than peephole2, for example when there are - unrelated insns between the interesting ones. */ + splits from `avr_split_fake_addressing_move'. We do this in an own + pass because it can find more cases than peephole2, for example when + there are unrelated insns between the interesting ones. */ INSERT_PASS_BEFORE (pass_peephole2, 1, avr_pass_fuse_add); @@ -47,9 +47,9 @@ INSERT_PASS_BEFORE (pass_free_cfg, 1, avr_pass_recompute_notes); tries to fix such situations by operating on the original mode. This reduces code size and register pressure. - The assertion is that the code generated by casesi is unaltered and a + The assertion is that the code generated by casesi is unaltered and a sign-extend or zero-extend from QImode or HImode precedes the casesi - insns withaout any insns in between. */ + insns without any insns in between. */ INSERT_PASS_AFTER (pass_expand, 1, avr_pass_casesi); diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 289c80cab550..d6f4abbac669 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -179,7 +179,7 @@ extern rtl_opt_pass *make_avr_pass_casesi (gcc::context *); extern rtl_opt_pass *make_avr_pass_ifelse (gcc::context *); #ifdef RTX_CODE extern bool avr_casei_sequence_check_operands (rtx *xop); -extern bool avr_split_tiny_move (rtx_insn *insn, rtx *operands); +extern bool avr_split_fake_addressing_move (rtx_insn *insn, rtx *operands); #endif /* RTX_CODE */ /* From avr-log.cc */ diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index f477ac170ea2..520f1fe41a21 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -993,41 +993,10 @@ (clobber (reg:CC REG_CC))])]) -;; For LPM loads from AS1 we split -;;R = *Z -;; to -;;R = *Z++ -;;Z = Z - sizeof (R) -;; -;; so that the second instruction can be optimized out. - -(define_split ; "split-lpmx" - [(set (match_operand:HISI 0 "register_operand" "") -(match_operand:HISI 1 "memory_operand" ""))] -