From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5B1563858D39 for ; Wed, 15 Dec 2021 13:19:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5B1563858D39 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-471-Md9XKs14PiSf1reGP79wvw-1; Wed, 15 Dec 2021 08:19:02 -0500 X-MC-Unique: Md9XKs14PiSf1reGP79wvw-1 Received: by mail-wm1-f72.google.com with SMTP id 187-20020a1c02c4000000b003335872db8dso12585281wmc.2 for ; Wed, 15 Dec 2021 05:19:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aXieXZ34iSvbx/c9tFG4KeXTxgxUZgFu3WCO5VkxuIk=; b=X/21zhUKe3CbNLa+sTcJcRE3NlcmGO4lVI+pqa90zB2IGVabaSZT7RYp6/aTZGNx1M S/jYjctJucJX2pWalI3dKGmGBR7lTEGzciUauNRXk+Sd7AH7EEZYbJ82uhwOttzdxYRl WUJHSEPwwxug96XlQ3RlOZjkWQ5ybDaO85fiRivpsb9di9uHwag6YF4w7kPtE1De9+l3 /ucYOGbH0GvoVlXeMPRX0eEfeCfdqd8ZAu4DFa8Z6wkIggSGiR3tEGOGur+kcjNsqhS8 fji2Cib8bbOCo+HBOTQJx4hhmh5+M/zzLnKhub3qe5UoM7XyNdLG5ro3DZCAx2RzJx24 RtRQ== X-Gm-Message-State: AOAM531VYt6z6CTbq6hU/ZGBEQLbuc1ZA6vMUrakJKzgdkAUldrdpfFM eo9TorPj6YJL4BpXj/UCN8gjbS9OpgS+fdpwYQqWXBw0BXt1N5KO9+z0T9IrIMahsEFoISM8LZO clpvYeui0kypsRmeYLUAQ+g== X-Received: by 2002:a5d:4591:: with SMTP id p17mr4342509wrq.483.1639574341500; Wed, 15 Dec 2021 05:19:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSIO5GyQtSExhD0c6PYkF+fQsY2iCklrhicvv3w59zFGBFxLC9zD2XB26L1Dky+b0bkktxuw== X-Received: by 2002:a5d:4591:: with SMTP id p17mr4342494wrq.483.1639574341262; Wed, 15 Dec 2021 05:19:01 -0800 (PST) Received: from localhost (host86-134-238-138.range86-134.btcentralplus.com. [86.134.238.138]) by smtp.gmail.com with ESMTPSA id h16sm2370192wrm.27.2021.12.15.05.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 05:19:00 -0800 (PST) Date: Wed, 15 Dec 2021 13:19:00 +0000 From: Andrew Burgess To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/6] Avoid redundant operations in `fortran_array_walker' Message-ID: <20211215131900.GJ175541@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 13:18:46 up 2 days, 23:36, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Dec 2021 13:19:07 -0000 * Maciej W. Rozycki [2021-12-11 11:47:14 +0000]: > Move inner dimension's element type determination outside the respective > loops in `fortran_array_walker'. The operation is exactly the same with > each iteration, so there is no point in redoing it for each element and > while a smart compiler might be able to move it outside the loop it is > regardless a bad coding style. No functional change. LGTM. Thanks, Andrew > --- > gdb/f-array-walker.h | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > gdb-fortran-array-walker-walk-type.diff > Index: src/gdb/f-array-walker.h > =================================================================== > --- src.orig/gdb/f-array-walker.h > +++ src/gdb/f-array-walker.h > @@ -208,6 +208,8 @@ class fortran_array_walker > > if (nss != m_ndimensions) > { > + struct type *subarray_type = TYPE_TARGET_TYPE (check_typedef (type)); > + > /* For dimensions other than the inner most, walk each element and > recurse while peeling off one more dimension of the array. */ > for (LONGEST i = lowerbound; > @@ -218,13 +220,13 @@ class fortran_array_walker > LONGEST new_offset = offset + calc.index_offset (i); > > /* Now print the lower dimension. */ > - struct type *subarray_type > - = TYPE_TARGET_TYPE (check_typedef (type)); > walk_1 (nss + 1, subarray_type, new_offset, (i == upperbound)); > } > } > else > { > + struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); > + > /* For the inner most dimension of the array, process each element > within this dimension. */ > for (LONGEST i = lowerbound; > @@ -233,7 +235,6 @@ class fortran_array_walker > { > LONGEST elt_off = offset + calc.index_offset (i); > > - struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type)); > if (is_dynamic_type (elt_type)) > { > CORE_ADDR e_address = m_address + elt_off; >