From patchwork Wed Jul 8 12:32:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 138730 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D63854BA2E10 for ; Wed, 8 Jul 2026 12:33:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D63854BA2E10 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wlGgnyq5; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=PvMbWKEp; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=YLDfFz9n; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=D8Z2edPf X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id D75694BA540B for ; Wed, 8 Jul 2026 12:32:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D75694BA540B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D75694BA540B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783513952; cv=none; b=BJ62GzS9tzzz2kh/v6UwC8I1Q5BmaUUah83T8+CLcgeQe5NVlMj/XftaRhOHEcWjTqGzdmMz9aYX5WIMi2EWoNxVXTEHt+LBQ8vJz+D/LY4XPt8CRGN7jteA5zLTkUkK7KoaFhtZ7PCg5qjHXx5U7wM52QHM+z3qGcIvTvcszNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783513952; c=relaxed/simple; bh=cc45D0NR7Ocs8PNr1a66YXGCrwWmTqJvmRTwr8rqLrQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=lXeWWNwLl7kbOxMmowvClt7WDACQhCtS27BSMxnWWAy7JIluubKtVlIUU0+anh85odGew0JzgFhcPZGoKB5pYLbSOEKFfkySt6k+0liAvAUuNNX7+Tiu+QrRc9z+jF6VOjNdyGNThKfhe5DbkDoCTt5n7DhfpKYao1HFhfE+gPU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=wlGgnyq5; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=PvMbWKEp; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=YLDfFz9n; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=D8Z2edPf DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D75694BA540B Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CEC5175C32; Wed, 8 Jul 2026 12:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1783513951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=vnHrK7OM4wU8a/pjNXuFodCA/CRH+unNY1SRYaPoYfs=; b=wlGgnyq5IFIuearVW1cnMKc3ghgWfA6MTaccF1ewV533yvhEr+IeBHm/RauSUalXx5Eu0u nAS0/gHiCGKhpKMidM9Nv2/EIUxHSgRAsUnvhlM0vFV3xMrl8VmUGb7qT6bHFzD4VWOOks uIqb+0H9f1y5qCnSoLluAZX3+sF/33o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1783513951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=vnHrK7OM4wU8a/pjNXuFodCA/CRH+unNY1SRYaPoYfs=; b=PvMbWKEpq/KlVuJQUS3hhRGOlC3F4ideyc470MR+m5FyX0wLJNJiQ844Yc6D2s5mX6UWUi BMtyKaS21DEO22AQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1783513950; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=vnHrK7OM4wU8a/pjNXuFodCA/CRH+unNY1SRYaPoYfs=; b=YLDfFz9nZo0VwQjvSStkPCOohNK4Visgn79FCNXzDkCIqERWqJ2h5b6RcJXP0sFnlIssr3 V5svrZR99AUUXUz5/ki1uRlSqxPbSDMHuTG3peUS61Qh7TJyBhtkwNJAiK2Z0QA+UmWDoM /cmE9vrbnQ4LQlZOU6RLYtjdkgeb6zs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1783513950; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=vnHrK7OM4wU8a/pjNXuFodCA/CRH+unNY1SRYaPoYfs=; b=D8Z2edPf1xNfOTqucT9X7UUqJnY5vYCgdg3yET9hQ5YRPiVdzbqhxGaChta1miUV1jWxsh Oe9tbmbBckbKTYDA== Date: Wed, 8 Jul 2026 14:32:30 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: tamar.christina@arm.com Subject: [PATCH] Remove group_size argument from vect_built_slp_tree* APIs Message-ID: MIME-Version: 1.0 X-Spam-Score: -4.30 X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[fhfr.qr:mid,tree-vect-slp.cc:url] X-Spam-Level: X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org The group_size argument is redundant with the stmt vector length. Bootstrap and regtest running on x86_64-unknown-linux-gnu. This is because there's confusion about what group_size is, the number of scalar lanes or the number of statements. With statements becoming possibly vector stmts how did you handle group_size? If the argument becomes useful there we should probably rename it? * tree-vect-slp.cc (vect_build_slp_tree_1): Remove group_size argument and adjust. (vect_build_slp_tree_2): Likewise. (vect_build_slp_tree): Likewise. (optimize_load_redistribution_1): Likewise. (vect_build_slp_instance): Likewise. (vect_analyze_slp_reduc_chain): Likewise. (vect_analyze_slp_reduction): Likewise. (vect_analyze_slp_reduction_group): Likewise. (vect_analyze_slp_instance): Likewise. (vect_lower_load_permutations): Likewise. --- gcc/tree-vect-slp.cc | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 0266e75888c..ff11b392305 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -1147,10 +1147,11 @@ vect_record_max_nunits (vec_info *vinfo, stmt_vec_info stmt_info, static bool vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, - vec stmts, unsigned int group_size, + vec stmts, poly_uint64 *max_nunits, bool *matches, bool *two_operators, tree *node_vectype) { + unsigned int group_size = stmts.length (); unsigned int i; stmt_vec_info first_stmt_info = stmts[0]; code_helper first_stmt_code = ERROR_MARK; @@ -1881,18 +1882,19 @@ static unsigned least_upthread_swappable_op_distance = -1U; static slp_tree vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, - vec stmts, unsigned int group_size, + vec stmts, poly_uint64 *max_nunits, bool *matches, unsigned *limit, unsigned *tree_size, scalar_stmts_to_slp_tree_map_t *bst_map); static slp_tree vect_build_slp_tree (vec_info *vinfo, - vec stmts, unsigned int group_size, + vec stmts, poly_uint64 *max_nunits, bool *matches, unsigned *limit, unsigned *tree_size, scalar_stmts_to_slp_tree_map_t *bst_map) { + unsigned int group_size = stmts.length (); if (slp_tree *leader = bst_map->get (stmts)) { if (dump_enabled_p ()) @@ -1937,7 +1939,7 @@ vect_build_slp_tree (vec_info *vinfo, "starting SLP discovery for node %p\n", (void *) res); poly_uint64 this_max_nunits = 1; - slp_tree res_ = vect_build_slp_tree_2 (vinfo, res, stmts, group_size, + slp_tree res_ = vect_build_slp_tree_2 (vinfo, res, stmts, &this_max_nunits, matches, limit, tree_size, bst_map); if (!res_) @@ -2025,11 +2027,12 @@ vect_slp_build_two_operator_nodes (slp_tree perm, tree vectype, static slp_tree vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, - vec stmts, unsigned int group_size, + vec stmts, poly_uint64 *max_nunits, bool *matches, unsigned *limit, unsigned *tree_size, scalar_stmts_to_slp_tree_map_t *bst_map) { + unsigned int group_size = stmts.length (); unsigned nops, i, this_tree_size = 0; poly_uint64 this_max_nunits = *max_nunits; @@ -2108,7 +2111,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, bool two_operators = false; unsigned char *swap = XALLOCAVEC (unsigned char, group_size); tree vectype = NULL_TREE; - if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size, + if (!vect_build_slp_tree_1 (vinfo, swap, stmts, &this_max_nunits, matches, &two_operators, &vectype)) return NULL; @@ -2205,7 +2208,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, } bool *matches2 = XALLOCAVEC (bool, dr_group_size); slp_tree unperm_load - = vect_build_slp_tree (vinfo, stmts2, dr_group_size, + = vect_build_slp_tree (vinfo, stmts2, &this_max_nunits, matches2, limit, &this_tree_size, bst_map); /* When we are able to do the full masked load emit that @@ -2509,7 +2512,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, else op_stmts.quick_push (NULL); child = vect_build_slp_tree (vinfo, op_stmts, - group_size, &this_max_nunits, + &this_max_nunits, matches, limit, &this_tree_size, bst_map); /* ??? We're likely getting too many fatal mismatches @@ -2947,7 +2950,7 @@ out: vec def_stmts2; def_stmts2.create (1); def_stmts2.quick_push (oprnd_info->def_stmts[0]); - child = vect_build_slp_tree (vinfo, def_stmts2, 1, + child = vect_build_slp_tree (vinfo, def_stmts2, &this_max_nunits, matches, limit, &this_tree_size, bst_map); @@ -3021,7 +3024,7 @@ out: else if (least_upthread_swappable_op_distance != -1U) least_upthread_swappable_op_distance++; child = vect_build_slp_tree (vinfo, oprnd_info->def_stmts, - group_size, &this_max_nunits, + &this_max_nunits, matches, limit, &this_tree_size, bst_map); least_upthread_swappable_op_distance = old_swap_distance; @@ -3083,7 +3086,7 @@ out: /* And try again with scratch 'matches' ... */ bool *tem = XALLOCAVEC (bool, group_size); if ((child = vect_build_slp_tree (vinfo, oprnd_info->def_stmts, - group_size, &this_max_nunits, + &this_max_nunits, tem, limit, &this_tree_size, bst_map)) != NULL) { @@ -3807,7 +3810,7 @@ optimize_load_redistribution_1 (scalar_stmts_to_slp_tree_map_t *bst_map, bool *matches = XALLOCAVEC (bool, group_size); poly_uint64 max_nunits = 1; unsigned tree_size = 0, limit = 1; - node = vect_build_slp_tree (vinfo, stmts, group_size, &max_nunits, + node = vect_build_slp_tree (vinfo, stmts, &max_nunits, matches, &limit, &tree_size, bst_map); if (!node) stmts.release (); @@ -4236,7 +4239,7 @@ vect_build_slp_instance (vec_info *vinfo, matches[1] = false; } else - node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, + node = vect_build_slp_tree (vinfo, scalar_stmts, &max_nunits, matches, limit, &tree_size, bst_map); if (node != NULL) @@ -4498,7 +4501,7 @@ vect_analyze_slp_reduc_chain (loop_vec_info vinfo, bool *matches = XALLOCAVEC (bool, group_size); poly_uint64 max_nunits = 1; unsigned tree_size = 0; - slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, + slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, &max_nunits, matches, limit, &tree_size, bst_map); if (!node) @@ -4646,7 +4649,7 @@ vect_analyze_slp_reduc_chain (loop_vec_info vinfo, for (unsigned i = 0; i < scalar_stmts.length (); ++i) REDUC_GROUP_FIRST_ELEMENT (scalar_stmts[i]) = scalar_stmts[0]; - slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, + slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, &max_nunits, matches, limit, &tree_size, bst_map); @@ -4790,7 +4793,7 @@ vect_analyze_slp_reduction (loop_vec_info vinfo, poly_uint64 max_nunits = 1; unsigned tree_size = 0; - slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, + slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, &max_nunits, matches, limit, &tree_size, bst_map); if (node != NULL) @@ -4862,7 +4865,6 @@ vect_analyze_slp_reduction_group (loop_vec_info loop_vinfo, poly_uint64 max_nunits = 1; unsigned tree_size = 0; slp_tree node = vect_build_slp_tree (loop_vinfo, scalar_stmts, - group_size, &max_nunits, matches, limit, &tree_size, bst_map); if (!node) @@ -5089,7 +5091,7 @@ vect_analyze_slp_instance (vec_info *vinfo, matches[1] = false; } else - node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, + node = vect_build_slp_tree (vinfo, scalar_stmts, &max_nunits, matches, limit, &tree_size, bst_map); if (node != NULL) @@ -5278,7 +5280,7 @@ vect_analyze_slp_instance (vec_info *vinfo, for (unsigned j = start; j < end; ++j) substmts.quick_push (scalar_stmts[j]); max_nunits = 1; - node = vect_build_slp_tree (vinfo, substmts, end - start, + node = vect_build_slp_tree (vinfo, substmts, &max_nunits, matches, limit, &tree_size, bst_map); if (node) @@ -5651,7 +5653,6 @@ vect_lower_load_permutations (loop_vec_info loop_vinfo, unsigned limit = 1; unsigned tree_size = 0; slp_tree l0 = vect_build_slp_tree (loop_vinfo, stmts, - group_lanes, &max_nunits, matches, &limit, &tree_size, bst_map); gcc_assert (!SLP_TREE_LOAD_PERMUTATION (l0).exists ());