From patchwork Mon Aug 7 19:12:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9886045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2017602CC for ; Mon, 7 Aug 2017 19:12:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C23402860A for ; Mon, 7 Aug 2017 19:12:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6EEC286BF; Mon, 7 Aug 2017 19:12:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5265C2860A for ; Mon, 7 Aug 2017 19:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751929AbdHGTMP (ORCPT ); Mon, 7 Aug 2017 15:12:15 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35373 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbdHGTMO (ORCPT ); Mon, 7 Aug 2017 15:12:14 -0400 Received: by mail-wm0-f68.google.com with SMTP id r77so2061035wmd.2 for ; Mon, 07 Aug 2017 12:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/BJ7RaWEp/+XY5y88KeOyW0v4v/CgEmNBhfUbfheITc=; b=Vv6EgIa+Px0xVeQPrBolNzoMaupoxRjGTG9BOz3YBqHV01GWEBMnSlrM4ZNAJ6Enun dLGSdWUenQA+Hs9GSEjgc3cPnp13/ERE7UzdfWDEq80CJjq/aEePy7iA8ZYWxETjIJk1 W6NgYbDMvBcg6eZhFgm+zJoaaluJbMieEp3DLs5dTu20+pgPWPKtZBMWduT96sUoHfl1 nGWKMb6s39Y6vycQvFhwCNZ0wEul1YAxh7SilXLliPGI6/mrtRa59cySZuaQKXxTWal1 uk1gZ/qNxnMXCzOBAdaNk6qKRVvOKLcn/BJqyNCRCuSYFPWeTvUwX/ReYD4XMEriBuRU yQbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/BJ7RaWEp/+XY5y88KeOyW0v4v/CgEmNBhfUbfheITc=; b=k/Ioni4sd+4TixADzVynNqTJTMLeDd2qXZIhtv84TjBA/Wrxvrider+QcrtcpLUQNA Wv6kJfWpbkb0M6/8ffHY0uFCJUQMijOXyd8CX8gdt+3jq6kTslYMD6y6P+RLF+ux8Kwb eO1QadfvCYLetn3EfifMNBcT4a/e0y37nfhpkrPhyY068jg6ub0ylMUf+pQOM7OOKJIG NKSSI/8zjEsFHRpInD3O4uTig80tvMiiTDhpEMC5ZD85WpchHr6/7dHUKL4r1rFQHaxA ND/h/gt4ey3vgxp85J3VPsNg+cJUcRp0S9e24WwfFl59bo/I2LzXpt/9lb+pOWcxucHn fc3A== X-Gm-Message-State: AHYfb5jDLlWZcVa37CDw0t/R3gZJncHNMN7ZSl2MvJmHw9keYo8Df5P0 vwzywX/IeDKziw== X-Received: by 10.80.143.129 with SMTP id y1mr1825722edy.107.1502133133591; Mon, 07 Aug 2017 12:12:13 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:4076:600:29ff:6bdc:a0fa:4163]) by smtp.gmail.com with ESMTPSA id g52sm7742064edg.34.2017.08.07.12.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 12:12:13 -0700 (PDT) From: Luc Van Oostenryck To: Dibyendu Majumdar Cc: linux-sparse@vger.kernel.org, Luc Van Oostenryck Subject: [PATCH v2 3/8] reuse nbr_pseudo_users() Date: Mon, 7 Aug 2017 21:12:00 +0200 Message-Id: <20170807191205.86590-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170807191205.86590-1-luc.vanoostenryck@gmail.com> References: <20170807191205.86590-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This small helper was used in unssa.c but is helpfull elsewhere too. Change it to an inline function and move it to one of the header. Signed-off-by: Luc Van Oostenryck --- linearize.h | 5 +++++ simplify.c | 2 +- unssa.c | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/linearize.h b/linearize.h index bac82d7ff..7f2e976e7 100644 --- a/linearize.h +++ b/linearize.h @@ -301,6 +301,11 @@ static inline struct pseudo_user *alloc_pseudo_user(struct instruction *insn, ps return user; } +static inline int nbr_pseudo_users(pseudo_t p) +{ + return ptr_list_size((struct ptr_list *)p->users); +} + static inline void use_pseudo(struct instruction *insn, pseudo_t p, pseudo_t *pp) { *pp = p; diff --git a/simplify.c b/simplify.c index d9528de43..8b63bcaff 100644 --- a/simplify.c +++ b/simplify.c @@ -800,7 +800,7 @@ static int simplify_associative_binop(struct instruction *insn) return 0; if (!simple_pseudo(def->src2)) return 0; - if (ptr_list_size((struct ptr_list *)def->target->users) != 1) + if (nbr_pseudo_users(def->target) != 1) return 0; switch_pseudo(def, &def->src1, insn, &insn->src2); return REPEAT_CSE; diff --git a/unssa.c b/unssa.c index e7c9154d5..736474b90 100644 --- a/unssa.c +++ b/unssa.c @@ -34,11 +34,6 @@ #include -static inline int nbr_pseudo_users(pseudo_t p) -{ - return ptr_list_size((struct ptr_list *)p->users); -} - static int simplify_phi_node(struct instruction *phi, pseudo_t tmp) { pseudo_t target = phi->target;