From patchwork Mon Sep 2 09:19:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1979578 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=bKI77/I+; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uXiPkBy+; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=bKI77/I+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uXiPkBy+; 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 4Wy39j08M1z1yXY for ; Mon, 2 Sep 2024 19:19:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 693AF385EC33 for ; Mon, 2 Sep 2024 09:19:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 5FFB1385DDD3 for ; Mon, 2 Sep 2024 09:19:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FFB1385DDD3 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 5FFB1385DDD3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725268748; cv=none; b=tGj3ee1pf2l7sfNXLgBfRkHrbdQK3ZdeMZ0LJoUEOhiGZO6ooLMF0/41znt52QFO5QSxFpKetyA41SS0e3r6xGP87JFPioJjcjy5LsGBf/SzK3SeDA9wOPI5k0VDwnc7knFr0c0aYmRyqbHfV8sIV5sGSEQbm1EO2H3Ig+lOpiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725268748; c=relaxed/simple; bh=IW0sWBIq1L7nQ0yvKdr38dCdtgwEoeCEJ7AmZhhuJWI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=EmmFsu/z3XfkImoiDTyo8skxL/etK+rfYRUPoZQ8dbzyWlRtfRfBVBmSwCqJLQM6ubhhUwvGMU2/m3fLzKFGdaOVcdmHX6XG10+ycjgPOyZm6uCcTayDWUlhSNNJKUX6CHTHQ7t+agNIlI3zXz7YN94x8LIz8Cp6EN+C/n/ubY4= ARC-Authentication-Results: i=1; server2.sourceware.org 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-out1.suse.de (Postfix) with ESMTPS id 5462721B34 for ; Mon, 2 Sep 2024 09:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1725268745; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=GdaqRpFasF+dDDjHlsYlhHP8hfdViAqeM/U9/FSg2Lo=; b=bKI77/I+PMVV3mPwP4ZwhMmALLjFjDHs9QLWjww5F7nVJW1btH5VaIg/9xfjFiOoKelSmk vRkRKh1C2HMqSjGON3CDXjdNs5qDXkTxJ6gR96HXHdsniSTqpA4GyXHfB7QQfIRhBB7lvH 2CiqgpK2nii5Z1hX8S1vH02T5PqR00s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1725268745; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=GdaqRpFasF+dDDjHlsYlhHP8hfdViAqeM/U9/FSg2Lo=; b=uXiPkBy+C0Bymkl/rnDMTW0jbnTJSldrnhzCOyTv+P6rm2RtEA42k1Lbi0HjYkp1iwz1hA OZdEtX27GBhFYGCQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1725268745; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=GdaqRpFasF+dDDjHlsYlhHP8hfdViAqeM/U9/FSg2Lo=; b=bKI77/I+PMVV3mPwP4ZwhMmALLjFjDHs9QLWjww5F7nVJW1btH5VaIg/9xfjFiOoKelSmk vRkRKh1C2HMqSjGON3CDXjdNs5qDXkTxJ6gR96HXHdsniSTqpA4GyXHfB7QQfIRhBB7lvH 2CiqgpK2nii5Z1hX8S1vH02T5PqR00s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1725268745; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=GdaqRpFasF+dDDjHlsYlhHP8hfdViAqeM/U9/FSg2Lo=; b=uXiPkBy+C0Bymkl/rnDMTW0jbnTJSldrnhzCOyTv+P6rm2RtEA42k1Lbi0HjYkp1iwz1hA OZdEtX27GBhFYGCQ== Date: Mon, 2 Sep 2024 11:19:05 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Correctly handle store IFNs in vect_get_vector_types_for_stmt MIME-Version: 1.0 X-Spam-Score: -1.13 X-Spamd-Result: default: False [-1.13 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-0.33)[-0.333]; NEURAL_HAM_SHORT(-0.20)[-0.987]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Level: X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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 Message-Id: <20240902091930.693AF385EC33@sourceware.org> Currently vect_get_vector_types_for_stmt only special-cases IFN_MASK_STORE but there are now very many variants and simply passing analysis without setting *VECTYPE will ICE duing SLP discovery (noticed with IFN_SCATTER_STORE). The following properly uses internal_store_fn_p. I also noticed we're unnecessarily handing those again to determine the scalar type but there should always be a data reference for them. Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll wait for aarch64 CI before checking in. Richard. * tree-vect-stmts.cc (vect_get_vector_types_for_stmt): Handle all internal_store_fn_p the same. Remove special-casing for the scalar_type of IFN_MASK_STORE. --- gcc/tree-vect-stmts.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 4eac5ebaf91..f22be63e769 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -14880,8 +14880,10 @@ vect_get_vector_types_for_stmt (vec_info *vinfo, stmt_vec_info stmt_info, if (gimple_get_lhs (stmt) == NULL_TREE /* Allow vector conditionals through here. */ && !is_a (stmt) - /* MASK_STORE has no lhs, but is ok. */ - && !gimple_call_internal_p (stmt, IFN_MASK_STORE)) + /* MASK_STORE and friends have no lhs, but are ok. */ + && !(is_gimple_call (stmt) + && gimple_call_internal_p (stmt) + && internal_store_fn_p (gimple_call_internal_fn (stmt)))) { if (is_a (stmt)) { @@ -14931,8 +14933,6 @@ vect_get_vector_types_for_stmt (vec_info *vinfo, stmt_vec_info stmt_info, if (data_reference *dr = STMT_VINFO_DATA_REF (stmt_info)) scalar_type = TREE_TYPE (DR_REF (dr)); - else if (gimple_call_internal_p (stmt, IFN_MASK_STORE)) - scalar_type = TREE_TYPE (gimple_call_arg (stmt, 3)); else scalar_type = TREE_TYPE (gimple_get_lhs (stmt));