From patchwork Tue Dec 12 16:50:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 1875311 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.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=NCW9zIdl; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7Gr4Jlv6; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=pcLWd7fj; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=S9cZ+CDi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4SqPkQ6Mlqz20Gs for ; Wed, 13 Dec 2023 03:50:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E48C93858033 for ; Tue, 12 Dec 2023 16:50:36 +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 [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 6B63B3858C2A for ; Tue, 12 Dec 2023 16:50:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B63B3858C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B63B3858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702399825; cv=none; b=tn0W2idmpvmzCMntxAQUnCKBgjmxwLoeUz/crqnpfkve76oayFIlc0INqwI7nEWQu6+GguxA0eY+Iq0a8fIY72PGfEOPToncX9GvSzi0FkIG+pS5SuQkmR/GyU8oig1qa7jtPxHvFoLcFMpK0JfKgnMb0dNr/1a7lCvoZC+IGRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702399825; c=relaxed/simple; bh=pxpnobidM7wxdJjQWLqnX0zADtGIk0RSdtngbdhbG2g=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=sLnO2cQFKQdAFDWVak0GyKOSO1wTb8NO6TRxWGBkaMLqfpTaupG/sAOIvbgILXwoA6zlmcPyB9oBop6N+sFkpqSTaUznzE3VGJ8X8jcJhYftpmzugwBt+ct/qkSKJfd2S4TF0DkrIfw1U1ApI5ejjDn/5PpwXkKLO/xaZmvVMtE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 E145F1F74A; Tue, 12 Dec 2023 16:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702399820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=/ioCwEwSU+iwzYNdMvBRjmRErS1d5PHbnY0rgOHrqkk=; b=NCW9zIdlp/0p6+npiyVuLY3ezSJTx19OYIBCri/NsjV9XlRU5C3Mg3rGvQDsno4+kCdJbc unNcrWNHOy4zgb+sB/C/1HbEb+tFsJvjtHxaFriCC8SovMyTCL3N4zNNRX8KWaFHKD8bxW b2N8T5R/vLxZLw7pi1MgJkc5l0INdxo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702399820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=/ioCwEwSU+iwzYNdMvBRjmRErS1d5PHbnY0rgOHrqkk=; b=7Gr4Jlv6UNCwiYXmhS5VEi90bHgZ3mKwC6+6dKWNZzDnK+z4F1XyvXQ3Cl4E7lm0s2Lsk0 /8yNBd/ADDAl7yCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702399819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=/ioCwEwSU+iwzYNdMvBRjmRErS1d5PHbnY0rgOHrqkk=; b=pcLWd7fj7M12YYZ2TzZtSb1An6Vtw1opjiVIqFWiLUXG5UURiOJyLjbYbtuuK1Un09J4Qs K3MhKDYX7lSm0QstRUjViKcG29x8FCOFmZld3e8ogJ4clcY+XCjGSZMgtX2JlCTu1DBW/v q5OLccZoEv5xqEZ6PENQ11/1fPnCDY4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702399819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=/ioCwEwSU+iwzYNdMvBRjmRErS1d5PHbnY0rgOHrqkk=; b=S9cZ+CDib6z21IPc6P/GeAt0CBlI+d3dUT+7WMHyjOmCVb6j2NKJcNs+WxHO5ty8m8L4Eb PHJjIIRRakEjycBg== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id DA510132DC; Tue, 12 Dec 2023 16:50:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id vd5INUuPeGU/AQAAn2gu4w (envelope-from ); Tue, 12 Dec 2023 16:50:19 +0000 From: Martin Jambor To: GCC Patches Cc: Richard Biener Subject: [PATCH] SRA: Force gimple operand in an additional corner case (PR 112822) User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/29.1 (x86_64-suse-linux-gnu) Date: Tue, 12 Dec 2023 17:50:19 +0100 Message-ID: MIME-Version: 1.0 X-Spam-Level: X-Spam-Score: 0.95 X-Spam-Level: X-Rspamd-Server: rspamd1 X-Rspamd-Queue-Id: E145F1F74A X-Spam-Flag: NO Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=pcLWd7fj; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=S9cZ+CDi; dmarc=none; spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of mjambor@suse.cz) smtp.mailfrom=mjambor@suse.cz X-Spamd-Result: default: False [-2.76 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[suse.cz]; R_SPF_SOFTFAIL(0.00)[~all:c]; DWL_DNSWL_HI(-3.50)[suse.cz:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_ALL(0.00)[]; INVALID_MSGID(1.70)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.15)[68.78%] X-Spam-Score: -2.76 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, INVALID_MSGID, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 Hi, PR 112822 revealed a corner case in load_assign_lhs_subreplacements where it creates invalid gimple: an assignment where on the LHS there is a complex variable which however is not a gimple register because it has partial defs and on the right hand side there is a VIEW_CONVERT_EXPR. This patch invokes force_gimple_operand_gsi on such statements (like it already does when both sides of a generated assignment have partial definitions. I've made sure the patch passes bootstrap and testsuite on x86_64-linux, the bug reporter was kind enough to also check the same on an powerpc64le-linux (see bugzilla comment #8). The testcase has reasonable size but it is specific to ppc64le and its altivec vectors. My plan is to ask the bug reporter to massage it into a target specific testcase in bugzilla. Alternatively I can try to craft a testcase from scratch but that will take time. Despite the above, is the patch OK for master? Thanks, Martin gcc/ChangeLog: 2023-12-12 Martin Jambor PR tree-optimization/112822 * tree-sra.cc (load_assign_lhs_subreplacements): Invoke force_gimple_operand_gsi also when LHS has partial stores and RHS is a VIEW_CONVERT_EXPR. --- gcc/tree-sra.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc index 3bd0c7a9af0..99a1b0a6d17 100644 --- a/gcc/tree-sra.cc +++ b/gcc/tree-sra.cc @@ -4219,11 +4219,15 @@ load_assign_lhs_subreplacements (struct access *lacc, if (racc && racc->grp_to_be_replaced) { rhs = get_access_replacement (racc); + bool vce = false; if (!useless_type_conversion_p (lacc->type, racc->type)) - rhs = fold_build1_loc (sad->loc, VIEW_CONVERT_EXPR, - lacc->type, rhs); + { + rhs = fold_build1_loc (sad->loc, VIEW_CONVERT_EXPR, + lacc->type, rhs); + vce = true; + } - if (racc->grp_partial_lhs && lacc->grp_partial_lhs) + if (lacc->grp_partial_lhs && (vce || racc->grp_partial_lhs)) rhs = force_gimple_operand_gsi (&sad->old_gsi, rhs, true, NULL_TREE, true, GSI_SAME_STMT); }