From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id ED494385F3D2 for ; Mon, 12 Dec 2022 21:56:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED494385F3D2 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 1D7C428088F; Mon, 12 Dec 2022 22:56:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1670882175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UGnYxes1ZMQCIhQdkaObgEqe22XJoxYSHhBUoosW5YQ=; b=mZFeb1jSSbORzi8P6s7QZuxLJHX8Eqb38zxmZwWr27n594hUkNV8HVEOk8y5Doc1s2dVlV PiwCDpMyAlxyaS5GsOfBmn75Sy8A97wgEgJsRTeNqZDh+sEohdofbIv+puhlD7s9pU+CSw yWt8i7Q/2N/m19smj5XCMx9qWN9Ox2Q= Date: Mon, 12 Dec 2022 22:56:15 +0100 From: Jan Hubicka To: Martin Jambor Cc: GCC Patches Subject: Re: [PATCH 8/9] ipa-sra: Make scan_expr_access bail out on uninteresting expressions Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: > Hi, > > I'm re-posting patches which I have posted at the end of stage 1 but > which have not passed review yet. > > 8<-------------------------------------------------------------------- > > 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. > > 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? > > > gcc/ChangeLog: > > 2021-12-14 Martin Jambor > > * ipa-sra.c (scan_expr_access): Bail out early if expr is something we > clearly do not need to pass to get_ref_base_and_extent. > --- > gcc/ipa-sra.cc | 5 +++++ > 1 file changed, 5 insertions(+) > > 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_scan_context ctx, > || TREE_CODE (expr) == REALPART_EXPR) > expr = TREE_OPERAND (expr, 0); > > + if (!handled_component_p (expr) > + && !DECL_P (expr) > + && TREE_CODE (expr) != 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. Honza > + > base = get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size, &reverse); > > if (TREE_CODE (base) == MEM_REF) > -- > 2.38.1 >