From patchwork Thu Apr 13 16:55:49 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: 9679741 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 1D44C60381 for ; Thu, 13 Apr 2017 16:56:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F52F2869B for ; Thu, 13 Apr 2017 16:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 043B6286A4; Thu, 13 Apr 2017 16:56:09 +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 9D214286AA for ; Thu, 13 Apr 2017 16:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754147AbdDMQ4H (ORCPT ); Thu, 13 Apr 2017 12:56:07 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33353 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754032AbdDMQ4E (ORCPT ); Thu, 13 Apr 2017 12:56:04 -0400 Received: by mail-wm0-f66.google.com with SMTP id o81so13661561wmb.0 for ; Thu, 13 Apr 2017 09:56:04 -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=0UVpSK0CRC+n39LXSsrK1cONkL876Bc8/e7YUH39Lxo=; b=UoTd5KiDEWU/QEQc3Zre8+1JHb414gu79TGNHl7ha0KrWCzC3jpm+IR4NSw359BVhb GAau295q4/pflIaobLq5bWnik15qRoAsZfqlFIVQtsUna0O7yG1MRkSHunjOHEG5OcVj XE8CSP7ktYwROWnT1dUMfsgNxvX0Ws5zL00IoJft9JkdVKAVvzuMsxYExfm6AUHIPERk v/Q2YRbaYTkW3NlCCzoG/ynx2gzuDJkztO5TkiEiDqQCNBQUfnkpZ8rPNwB+CtNFM/6q thJELO4WQv55eKORuLQ4tVSpiQy6i+KM1EpiC2Iyem7CNKfCu6/0MiFbBhODyj0dK59C xR/g== 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=0UVpSK0CRC+n39LXSsrK1cONkL876Bc8/e7YUH39Lxo=; b=GkMXVtaa6ImuntcfKDuYr6YdSClEa4g3Rte82GNubttudisM0egyNJp66hyGSSY4s/ 9Xt/Wmf2pu9kKbEvqJmurBQxEqeqGnXXAlBoQ7g5s5gH9oroyo8bSPexnl39r4D38oxZ 4ZC1UERpcnkEUULKpLenKESw/1ZqC4wAuie1hRgzw7ZnPUVupPV2fy5OsF5Jxn9QIHDS bbmD/O+k3FMjtsYWaFfiM3zEiLj/zRyYxImdDHETfwM4T2Ke2KCNSzqSg8TskN90Qk9X ZAog/VbHjJRi+k+2Owo3lorJM1DCIzM+KWFPB0KWxGTA9Yuudf/XiMegTTZmndcSVzDL B76w== X-Gm-Message-State: AN3rC/4YgJsVzaMzo8KtSWYRGq6Y5VXsgGVeG7akY0dUaDBn5xdzgSF/ AUHehhv5tiAn7Q== X-Received: by 10.28.58.11 with SMTP id h11mr4373536wma.60.1492102563316; Thu, 13 Apr 2017 09:56:03 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:8b2:dc00:a909:829c:fd:bc60]) by smtp.gmail.com with ESMTPSA id q129sm13297803wmg.1.2017.04.13.09.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 09:56:02 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH 6/8] integrate add_load_dominators() into rewrite_load_instruction() Date: Thu, 13 Apr 2017 18:55:49 +0200 Message-Id: <20170413165551.2785-7-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170413165551.2785-1-luc.vanoostenryck@gmail.com> References: <20170413165551.2785-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 Signed-off-by: Luc Van Oostenryck --- flow.c | 12 ++++++++---- flow.h | 4 +--- memops.c | 4 +--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flow.c b/flow.c index 678f9ba86..b64a3f74a 100644 --- a/flow.c +++ b/flow.c @@ -406,6 +406,7 @@ found_dominator: return 1; } +static void add_dominator(struct pseudo_list **phi_list, struct instruction *insn, struct instruction *dom, struct ident *ident) { @@ -417,6 +418,7 @@ void add_dominator(struct pseudo_list **phi_list, struct instruction *insn, use_pseudo(insn, phi, add_pseudo(phi_list, phi)); } +static struct pseudo_list *add_load_dominators(struct instruction *insn, struct instruction_list *doms, struct ident *ident) { @@ -433,10 +435,14 @@ struct pseudo_list *add_load_dominators(struct instruction *insn, struct instruc * We should probably sort the phi list just to make it easier to compare * later for equality. */ -void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *dominators) +void rewrite_load_instruction(struct instruction *insn, struct instruction_list *doms, + struct ident *ident) { + struct pseudo_list *dominators; pseudo_t new, phi; + dominators = add_load_dominators(insn, doms, ident); + /* * Check for somewhat common case of duplicate * phi nodes. @@ -473,7 +479,6 @@ static int find_dominating_stores(pseudo_t pseudo, struct instruction *insn, struct basic_block *bb = insn->bb; struct instruction *one, *dom = NULL; struct instruction_list *dominators; - struct pseudo_list *phi_list; int partial; /* Unreachable load? Undo it */ @@ -535,8 +540,7 @@ found: * have to turn the load into a phi-node of the * dominators. */ - phi_list = add_load_dominators(insn, dominators, pseudo->ident); - rewrite_load_instruction(insn, phi_list); + rewrite_load_instruction(insn, dominators, pseudo->ident); return 1; } diff --git a/flow.h b/flow.h index a6d0881c2..99bfcc879 100644 --- a/flow.h +++ b/flow.h @@ -37,9 +37,7 @@ static inline void kill_instruction_force(struct instruction *insn) void check_access(struct instruction *insn); void convert_load_instruction(struct instruction *, pseudo_t); -void rewrite_load_instruction(struct instruction *, struct pseudo_list *); -void add_dominator(struct pseudo_list **, struct instruction *, struct instruction *, struct ident*); -struct pseudo_list *add_load_dominators(struct instruction *, struct instruction_list *, struct ident*); +void rewrite_load_instruction(struct instruction *, struct instruction_list *, struct ident*); int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local); extern void clear_liveness(struct entrypoint *ep); diff --git a/memops.c b/memops.c index 39469e260..bbb1831af 100644 --- a/memops.c +++ b/memops.c @@ -115,7 +115,6 @@ static void simplify_loads(struct basic_block *bb) bb->generation = generation; dominators = NULL; if (find_dominating_parents(pseudo, insn, bb, generation, &dominators, local)) { - struct pseudo_list *phi_list; /* This happens with initial assignments to structures etc.. */ if (!dominators) { if (local) { @@ -124,8 +123,7 @@ static void simplify_loads(struct basic_block *bb) } goto next_load; } - phi_list = add_load_dominators(insn, dominators, NULL); - rewrite_load_instruction(insn, phi_list); + rewrite_load_instruction(insn, dominators, NULL); } } next_load: