From patchwork Tue May 21 12:44:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1937400 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.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=fQtxlDUH; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sHuPNG84; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fQtxlDUH; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sHuPNG84; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VkDfx221gz1ydW for ; Tue, 21 May 2024 22:45:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8FB663857C4F for ; Tue, 21 May 2024 12:45:10 +0000 (GMT) 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 [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 68CAD385840B for ; Tue, 21 May 2024 12:44:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68CAD385840B 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 68CAD385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716295492; cv=none; b=mI25pbHubq9phg7AV8CBbrXOCu7/cJvIUzHx1Rr0ze7F64tQMZhpGAlcU6pgcJbM9s2xCPqDslM43oX9kEncFIF2+mr68fE2Jk7jaaPy/UXIRGd78CvUW+fzg/yUk6xXihcLBJdA0ueDfpNyWzJDXRM4ctoGJeyg04MDGUtCPTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716295492; c=relaxed/simple; bh=lFKQ5u4eukQl4TVdHBAPE9YkPW6eKqehKO/3aUKlvKw=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version:Message-Id; b=rw7lYnTNOBZTmUPB40ggqc4KFwtAb1APGlB+F/PLE378jr5i9ovT33JshhcXbZyqjsHOw4BEquQ0+36CGOd1R7v9isGhCXiGM4yFXBW55A+8cJgRhaGrxMIpWUypef564mdczDX/fDfQyX6Dp7ksjB3czStT/S0wtTLZzJZOUbw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 6460E5C139 for ; Tue, 21 May 2024 12:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716295489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZIBc1Vn8ayWRGsrTlobfPAP1ZlUIG82cUt6TkPMPAyM=; b=fQtxlDUHyCPtGvKSk3DujvYEIoBHjsUBNotyKwqYchfop/BWGYZCFPmESL1Q/GGgYVxQbz ooY+nwaQmb9TJi/o/iYldZVyrVSdeDmLqQSHcqa0QahwYU7AhHhdzA0z3dledyOJPSU4iS ISNZWN/xZhocj7+mwPqzQPHdHHW0X/A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716295489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZIBc1Vn8ayWRGsrTlobfPAP1ZlUIG82cUt6TkPMPAyM=; b=sHuPNG84b3wlqi+ZeH8BYvPsE2eVl/3QvIbtLVoE9jRH5F0s67yy3DxK8+QQy4QfH1s8fN d+NdpvjGID0CVrBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716295489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZIBc1Vn8ayWRGsrTlobfPAP1ZlUIG82cUt6TkPMPAyM=; b=fQtxlDUHyCPtGvKSk3DujvYEIoBHjsUBNotyKwqYchfop/BWGYZCFPmESL1Q/GGgYVxQbz ooY+nwaQmb9TJi/o/iYldZVyrVSdeDmLqQSHcqa0QahwYU7AhHhdzA0z3dledyOJPSU4iS ISNZWN/xZhocj7+mwPqzQPHdHHW0X/A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716295489; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZIBc1Vn8ayWRGsrTlobfPAP1ZlUIG82cUt6TkPMPAyM=; b=sHuPNG84b3wlqi+ZeH8BYvPsE2eVl/3QvIbtLVoE9jRH5F0s67yy3DxK8+QQy4QfH1s8fN d+NdpvjGID0CVrBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4A5F513A21 for ; Tue, 21 May 2024 12:44:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id NgCCEEGXTGZIcwAAD6G6ig (envelope-from ) for ; Tue, 21 May 2024 12:44:49 +0000 Date: Tue, 21 May 2024 14:44:44 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/4] Avoid SLP_REPRESENTATIVE access for VEC_PERM in SLP scheduling MIME-Version: 1.0 Message-Id: <20240521124449.4A5F513A21@imap1.dmz-prg2.suse.org> X-Spam-Level: X-Spamd-Result: default: False [-4.18 / 50.00]; BAYES_HAM(-2.88)[99.50%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gcc-patches@gcc.gnu.org]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.18 X-Spam-Status: No, score=-11.6 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.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+incoming=patchwork.ozlabs.org@gcc.gnu.org SLP permute nodes can end up without a SLP_REPRESENTATIVE now, the following avoids touching it in this case in vect_schedule_slp_node. * tree-vect-slp.cc (vect_schedule_slp_node): Avoid looking at SLP_REPRESENTATIVE for VEC_PERM nodes. --- gcc/tree-vect-slp.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index f34ed54a70b..43f2c153bf0 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -9301,13 +9301,8 @@ vect_schedule_slp_node (vec_info *vinfo, gcc_assert (SLP_TREE_NUMBER_OF_VEC_STMTS (node) != 0); SLP_TREE_VEC_DEFS (node).create (SLP_TREE_NUMBER_OF_VEC_STMTS (node)); - if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, - "------>vectorizing SLP node starting from: %G", - stmt_info->stmt); - - if (STMT_VINFO_DATA_REF (stmt_info) - && SLP_TREE_CODE (node) != VEC_PERM_EXPR) + if (SLP_TREE_CODE (node) != VEC_PERM_EXPR + && STMT_VINFO_DATA_REF (stmt_info)) { /* Vectorized loads go before the first scalar load to make it ready early, vectorized stores go before the last scalar @@ -9319,10 +9314,10 @@ vect_schedule_slp_node (vec_info *vinfo, last_stmt_info = vect_find_last_scalar_stmt_in_slp (node); si = gsi_for_stmt (last_stmt_info->stmt); } - else if ((STMT_VINFO_TYPE (stmt_info) == cycle_phi_info_type - || STMT_VINFO_TYPE (stmt_info) == induc_vec_info_type - || STMT_VINFO_TYPE (stmt_info) == phi_info_type) - && SLP_TREE_CODE (node) != VEC_PERM_EXPR) + else if (SLP_TREE_CODE (node) != VEC_PERM_EXPR + && (STMT_VINFO_TYPE (stmt_info) == cycle_phi_info_type + || STMT_VINFO_TYPE (stmt_info) == induc_vec_info_type + || STMT_VINFO_TYPE (stmt_info) == phi_info_type)) { /* For PHI node vectorization we do not use the insertion iterator. */ si = gsi_none (); @@ -9456,6 +9451,9 @@ vect_schedule_slp_node (vec_info *vinfo, /* Handle purely internal nodes. */ if (SLP_TREE_CODE (node) == VEC_PERM_EXPR) { + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "------>vectorizing SLP permutation node\n"); /* ??? the transform kind is stored to STMT_VINFO_TYPE which might be shared with different SLP nodes (but usually it's the same operation apart from the case the stmt is only there for denoting @@ -9474,7 +9472,13 @@ vect_schedule_slp_node (vec_info *vinfo, } } else - vect_transform_stmt (vinfo, stmt_info, &si, node, instance); + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "------>vectorizing SLP node starting from: %G", + stmt_info->stmt); + vect_transform_stmt (vinfo, stmt_info, &si, node, instance); + } } /* Replace scalar calls from SLP node NODE with setting of their lhs to zero.