From patchwork Wed Apr 5 14:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp348286vqo; Wed, 5 Apr 2023 07:26:00 -0700 (PDT) X-Google-Smtp-Source: AKy350a5p4V/yapPejw6INSE7HWeLgDBBGuuaZKynv/aHBEfcSU1YAuVesnKLP+3APFGAlcLlDoy X-Received: by 2002:a17:906:3c52:b0:941:1cf6:dbea with SMTP id i18-20020a1709063c5200b009411cf6dbeamr3559334ejg.55.1680704760330; Wed, 05 Apr 2023 07:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680704760; cv=none; d=google.com; s=arc-20160816; b=AFRF9cFCrrjow6S53Hrlf4Uz7y/wlGi0I7yctryoGUEHHgtQRpFb13xjDdwk13P4nF 2cjViTJ+4tataR70A8WqGb+pEzdJGBA5YgnPbMD/1KbjbPuxXcxaoM8rxbv06TThMxb6 vj8uafh1M/PbxNkYqvmK3cqXNNDc7iDqU72aaFrWH9Ymorf6gi9m5UfVz53gdc0XcFJq wWoopgOnq+POXXol93QIdkwPix3XPFco4VyV9K7sJWCvpAgMu8LKJakj+MOh8uSANGBZ G+xwC2t2wvvNrG4npbMbYAGAbqCKSbL1ZEtKjzcxIHQmATZJZ7kkwrD1seEv3/raYNeg cx+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=F/LMRN4J6NtEY2kPr9euv93Xpqb7Yxnuzh469XKJk44=; b=dF5ccRbgQSgIIUJFoECOrb4DBzxNeHyCwFDZmY+U5AEfqvZyiaNhwAK2xOe3Q+3khi PehGY4VwTRpG5FsVyR7Urh1Pp/AsWATX5ol6BBAsLgEM2i12woLqs4VDOfLGmhidnly0 +c5ezwbEeUMWp/YMhK+TFGfERBzZ6eNFu0Uguqcb7kEnPt+sSyuASnpMpbkFwVMogBI+ eavum/g6He7+PzGMfqmpKZX86D1m8OoGy03tCDdrUPM30PotXIbqfvM3UiqAWGiWvyHN NTF0gRV09XXqUeh8cJh5pMZCPmXQz3L2XlXIS/8HboEvqF6dBmG6mWeGfLQMN07tW9QU ixNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="HqlQX7g/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a23-20020a17090682d700b0093001429138si11492201ejy.13.2023.04.05.07.26.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="HqlQX7g/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28EFE3959C69 for ; Wed, 5 Apr 2023 14:11:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 2CC4F385842C for ; Wed, 5 Apr 2023 14:05:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2CC4F385842C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x336.google.com with SMTP id j18-20020a05600c1c1200b003ee5157346cso23815575wms.1 for ; Wed, 05 Apr 2023 07:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703548; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=F/LMRN4J6NtEY2kPr9euv93Xpqb7Yxnuzh469XKJk44=; b=HqlQX7g/lykHQhS0S4Ouv2V7sllgorYoh1oiC7wYqOShJuBv88kfkxM/W839uZ0/LE 5aHojQhTxgZUP3rMlCDfG70ihSKUnZeZDLz7vtyD8VlMF7fdMx1yKAMLYT6K+5r2ELRl ISLLiGnscVtYO2EW8DGkBjBfBRUDTKIKW3aEtnVvOe1DmXsE0rZEdMNJ+SQ3hx5M/ncv 7y/XH26GfHXTJnPQqiUELiDqOA18M2CaTgsae583yhs9ISpPx0WDahgZqsuQxJkQCjoS S1EyKVkfzYTZvIU33TSL44qOgGS2h3GbrOE/LFUp4l3qIstBdunwd7+ROqxeY9M2xpO3 xHYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703548; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=F/LMRN4J6NtEY2kPr9euv93Xpqb7Yxnuzh469XKJk44=; b=PM8mUbV3KyH8w/wlssd1y7QFRPWrTe0tqR35zWQkiw+hG7bOn2A84Tktp65yEPK/Rb csEdJVAiCVE1FOzxGC1IDdktfSHHBImvxwDoHckmL/EUwTKIBtoDNCtoIAryRYD3FpbK AGxHg1AV4g4S+hOIgMJwiGndIRXQyTN1g67FnVIAga+yksi/ZYRxqffq6oiz8c2pn11H 2yps6Q2t+so+q4M0WfZJ4D/DHMrxp5tMrqUhy1d0OA/mQfWCfHUBueMei05e3kfhjzx6 txjiopJmGdGklRKrYm7cJzNELlhf+C0p21X8Z7fD4vK2sZ72bSyD6RARTJxXqwEVhoui SOPQ== X-Gm-Message-State: AAQBX9csgyJ4EggwXG9DVEhTQmIluKA+u1IX7QpFfOIFN2VubGc9J27A PPy+uGwkjuQLWfR6BJtl1lu/u4ML6QM/ijRu7g== X-Received: by 2002:a1c:7904:0:b0:3ef:128d:7167 with SMTP id l4-20020a1c7904000000b003ef128d7167mr5012586wme.13.1680703548471; Wed, 05 Apr 2023 07:05:48 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:05:48 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Owen Avery Subject: [committed 29/88] gccrs: Optimize HIR::ReferencePattern Date: Wed, 5 Apr 2023 16:03:13 +0200 Message-Id: <20230405140411.3016563-30-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 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: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762346674684844482?= X-GMAIL-MSGID: =?utf-8?q?1762346674684844482?= From: Owen Avery gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h (class ReferencePattern): Remove has_two_amps field. * hir/tree/rust-hir-full-test.cc (ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps. Signed-off-by: Owen Avery --- gcc/rust/hir/tree/rust-hir-full-test.cc | 5 ----- gcc/rust/hir/tree/rust-hir-pattern.h | 13 +++++-------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/gcc/rust/hir/tree/rust-hir-full-test.cc b/gcc/rust/hir/tree/rust-hir-full-test.cc index b6646d61b28..0ddb8418e95 100644 --- a/gcc/rust/hir/tree/rust-hir-full-test.cc +++ b/gcc/rust/hir/tree/rust-hir-full-test.cc @@ -2583,11 +2583,6 @@ ReferencePattern::as_string () const { std::string str ("&"); - if (has_two_amps) - { - str += "&"; - } - if (is_mut ()) { str += "mut "; diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h index 5243d7898c0..83b041d2770 100644 --- a/gcc/rust/hir/tree/rust-hir-pattern.h +++ b/gcc/rust/hir/tree/rust-hir-pattern.h @@ -424,7 +424,6 @@ protected: // HIR node for pattern based on dereferencing the pointers given class ReferencePattern : public Pattern { - bool has_two_amps; Mutability mut; std::unique_ptr pattern; Location locus; @@ -435,16 +434,15 @@ public: ReferencePattern (Analysis::NodeMapping mappings, std::unique_ptr pattern, Mutability reference_mut, - bool ref_has_two_amps, Location locus) - : has_two_amps (ref_has_two_amps), mut (reference_mut), - pattern (std::move (pattern)), locus (locus), mappings (mappings) + Location locus) + : mut (reference_mut), pattern (std::move (pattern)), locus (locus), + mappings (mappings) {} // Copy constructor requires clone ReferencePattern (ReferencePattern const &other) - : has_two_amps (other.has_two_amps), mut (other.mut), - pattern (other.pattern->clone_pattern ()), locus (other.locus), - mappings (other.mappings) + : mut (other.mut), pattern (other.pattern->clone_pattern ()), + locus (other.locus), mappings (other.mappings) {} // Overload assignment operator to clone @@ -452,7 +450,6 @@ public: { pattern = other.pattern->clone_pattern (); mut = other.mut; - has_two_amps = other.has_two_amps; locus = other.locus; mappings = other.mappings;