From patchwork Fri May 27 12:08:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 54461 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 29D3C394D8FF for ; Fri, 27 May 2022 13:29:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29D3C394D8FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653658185; bh=17taV9GZ4t0SvgzbOazyT5rho9hGWrzSrMPVc49/aNM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WKsHP7ylNCCdcz1Pilno97gTL08lOeVdiGUhg2GqZah96V4+SMfzuCVBVUEbopIyR mMvQZ3YCDHa/3coIIHC0RqPAP94upS6t+hgQvBDZBFckiytDRSKZiiPsPJp2lEYq4J g0kqsW3QPY1GJCTaYTMs1bEu4y1cZPHgcxuD04E4= 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.220.28]) by sourceware.org (Postfix) with ESMTPS id C315B398545B for ; Fri, 27 May 2022 12:08:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C315B398545B 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 B7DFF21A95 for ; Fri, 27 May 2022 12:08:10 +0000 (UTC) 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 A45CA13A84 for ; Fri, 27 May 2022 12:08:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id O4P4Jiq/kGL8HQAAMHmgww (envelope-from ) for ; Fri, 27 May 2022 12:08:10 +0000 Date: Fri, 27 May 2022 14:08:10 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid shift in get_ref_base_and_extent MIME-Version: 1.0 Message-Id: <20220527120810.A45CA13A84@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.7 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, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This avoids one instance of a shift from bytes to bits in get_ref_base_and_extent by using TYPE_SIZE instead of TYPE_SIZE_UNIT. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-dfa.cc (get_ref_base_and_extent): Avoid shift. --- gcc/tree-dfa.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc index 21c82cedb9f..e75e3d605b3 100644 --- a/gcc/tree-dfa.cc +++ b/gcc/tree-dfa.cc @@ -453,8 +453,8 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset, if (!next || TREE_CODE (stype) != RECORD_TYPE) { - tree fsize = DECL_SIZE_UNIT (field); - tree ssize = TYPE_SIZE_UNIT (stype); + tree fsize = DECL_SIZE (field); + tree ssize = TYPE_SIZE (stype); if (fsize == NULL || !poly_int_tree_p (fsize) || ssize == NULL @@ -465,7 +465,6 @@ get_ref_base_and_extent (tree exp, poly_int64_pod *poffset, poly_offset_int tem = (wi::to_poly_offset (ssize) - wi::to_poly_offset (fsize)); - tem <<= LOG2_BITS_PER_UNIT; tem -= woffset; maxsize += tem; }