From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id A0640383FD4B for ; Tue, 13 Dec 2022 08:40:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0640383FD4B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ABB7B33681; Tue, 13 Dec 2022 08:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1670920853; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5RYuA57YCV+cabI6ypW13TUxeTtxcU+RoackSnMhRQ=; b=2WN3fq47G/+YuiYfLtm1gpc1YtPRaj9AsTKwYO9J218I5SBzUmtAPkjec5zHTWBBCjjiOV 3CrOxSY8kAoyba8RI7y18ElP1GqCYfH/Ja2y3MMROAX1S18+Mkznh0UAYVGvyAg8yFRZIn 0VQQgUHC1Hgey2NU0fkbW4Kbbff0R84= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1670920853; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5RYuA57YCV+cabI6ypW13TUxeTtxcU+RoackSnMhRQ=; b=rbEO7AafYN2GPNx5AU26SqPbW3sLSdXbYMq8sCUiJsc8pO52aJRwLDTg0eJ44x0vO5jZ94 UX7JelqoOf2FM2CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 86A43138EE; Tue, 13 Dec 2022 08:40:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UYbcIJU6mGOvJgAAMHmgww (envelope-from ); Tue, 13 Dec 2022 08:40:53 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 8/9] ipa-sra: Make scan_expr_access bail out on uninteresting expressions Date: Tue, 13 Dec 2022 09:40:42 +0100 Message-Id: <1AEB9854-AF72-4D81-9172-EB04856E3846@suse.de> References: Cc: Martin Jambor In-Reply-To: To: Jan Hubicka via Gcc-patches X-Mailer: iPhone Mail (20B110) X-Spam-Status: No, score=-11.8 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 List-Id: > Am 12.12.2022 um 22:59 schrieb Jan Hubicka via Gcc-patches : >=20 > =EF=BB=BF >>=20 >>> Hi, >>>=20 >>> I'm re-posting patches which I have posted at the end of stage 1 but >>> which have not passed review yet. >>>=20 >>> 8<-------------------------------------------------------------------- >>>=20 >>> I have noticed that scan_expr_access passes all the expressions it >>> gets to get_ref_base_and_extent even when we are really only >>> interested in memory accesses. So bail out when the expression is >>> something clearly uninteresting. >>>=20 >>> Bootstrapped and tested individually when I originally posted it and >>> now bootstrapped and LTO-bootstrapped and tested as part of the whole >>> series. OK for master? >>>=20 >>>=20 >>> gcc/ChangeLog: >>>=20 >>> 2021-12-14 Martin Jambor >>>=20 >>> * ipa-sra.c (scan_expr_access): Bail out early if expr is something w= e >>> clearly do not need to pass to get_ref_base_and_extent. >>> --- >>> gcc/ipa-sra.cc | 5 +++++ >>> 1 file changed, 5 insertions(+) >>>=20 >>> diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc >>> index 93fceeafc73..3646d71468c 100644 >>> --- a/gcc/ipa-sra.cc >>> +++ b/gcc/ipa-sra.cc >>> @@ -1748,6 +1748,11 @@ scan_expr_access (tree expr, gimple *stmt, isra_s= can_context ctx, >>> || TREE_CODE (expr) =3D=3D REALPART_EXPR) >>> expr =3D TREE_OPERAND (expr, 0); >>>=20 >>> + if (!handled_component_p (expr) >>> + && !DECL_P (expr) >>> + && TREE_CODE (expr) !=3D MEM_REF) >>> + return; >> Is this needed because get_ref_base_and_extend crashes if given SSA_NAME >> or something else or is it just optimization? >> Perhaps Richi will know if there is better test for this. > Looking at: >=20 > static inline bool > gimple_assign_load_p (const gimple *gs) > { > tree rhs; > if (!gimple_assign_single_p (gs)) > return false; > rhs =3D gimple_assign_rhs1 (gs); > if (TREE_CODE (rhs) =3D=3D WITH_SIZE_EXPR) > return true; > rhs =3D get_base_address (rhs); > return (DECL_P (rhs) > || TREE_CODE (rhs) =3D=3D MEM_REF || TREE_CODE (rhs) =3D=3D TARGE= T_MEM_REF); > }=20 >=20 > I wonder if we don't want to avoid get_base_address (which is loopy) and > use same check and move it into a new predicate that is more convenient > to use? We can simplify the above to a single stripping of a handled component and c= onsidering another handled component as load (register ops are always single= ) Richard=20 >=20 > Honza >>=20 >> Honza >>> + >>> base =3D get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size, &= reverse); >>>=20 >>> if (TREE_CODE (base) =3D=3D MEM_REF) >>> --=20 >>> 2.38.1 >>>=20