From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id AEA0F383D03A; Wed, 2 Jun 2021 13:37:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AEA0F383D03A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: kKAG7DfQHoKKJy7LuqDCVJdXQOqL72FJqy9bptbWyIDnrMVEO+SbicLHltCwumV67UZw/+CPy/ faXryYN4vpRF9KGNMs0zNCPuJfX4xM9CZ+ejBUMlRxCtT24B0J+Y79bAEefSzg7aap1fw3tQKj fKwZaCSU0NsNB4Omu6i7Od4hyHpqFcsIy/idYhag2qIzaJiuQ0iH0vIyZ2RweQw6e4Soxk5qH/ P4s4xYQ0gjcFxg5Cs3+Vxv0/ApJbZQ69qGtFnVLnjHBNGNJfWrwSSz4quh2ZhyPdi+X9/lIWHo Yq0= X-IronPort-AV: E=Sophos;i="5.83,242,1616486400"; d="scan'208";a="61917324" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 02 Jun 2021 05:37:00 -0800 IronPort-SDR: owi6vOnrjS1/dkGzv51vdZUQnH+EldRl+U39YUI0WctwfufRjeO+U0UntYosRQU0KEjlPWfRer enx/StDmTcOtlQGtNqYp7XDqsqDzTYB9oUyXmmCKwsH0c+FyRdERPqT7kMgNhtl81uqgIaV1/1 xR+sDDEhpONDk8taKZhTAm2giXRq9//RPBmrf2Z9KP/y8zODIoPz0zQCgx849IW7RR7JKRD3+i oxOMj2a1WBn9XG4orXQnAGpdbRYULptrohFCWMyMqysPfiTwrZiDOncqb4ZvPY47+cKWk2nmyR uzw= Date: Wed, 2 Jun 2021 14:36:53 +0100 From: Julian Brown To: Richard Biener CC: GCC Patches , Jakub Jelinek , Tobias Burnus , Chung-Lin Tang , "fortran@gcc.gnu.org" , Thomas Schwinge Subject: Re: [PATCH 2/4] [og11] Unify ARRAY_REF/INDIRECT_REF stripping code in extract_base_bit_offset Message-ID: <20210602143653.05e028f5@squid.athome> In-Reply-To: References: <309548a704fdfbf6b2786d0eac659d4a493af65f.1622630252.git.julian@codesourcery.com> Organization: Mentor Graphics X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 13:37:12 -0000 On Wed, 2 Jun 2021 13:59:05 +0200 Richard Biener wrote: > On Wed, Jun 2, 2021 at 12:47 PM Julian Brown > wrote: > > > > For historical reasons, it seems that extract_base_bit_offset > > unnecessarily used two different ways to strip > > ARRAY_REF/INDIRECT_REF nodes from component accesses. I verified > > that the two ways of performing the operation gave the same results > > across the whole testsuite (and several additional benchmarks). > > But the two code paths clearly do sth different. The base_ref case > allows (*p)[i] while the !base_ref does not because TREE_CODE (base) > != COMPONENT_REF. > And the !base_ref case for INDIRECT_REF is quite odd, only allowing > *(x.p) where x.p is of REFERENCE_TYPE. > > Whatever this code is supposed to do ... maybe the "prologue" should > be inlined at the two callers instead. Thanks -- I'll go back and look at that bit again. I found it hard to figure out the intention behind these differences, since AFAIK the meaning should be the same -- maybe Jakub could weigh in as the original author of this bit (I believe)? (I figured something like "we can take this shortcut because we know we already did XYZ to this bit" -- this part was originally completely open-coded, i.e. there were two copies of this code, and it's only not open-coded now because I tried to factor out the common bits...) Julian