From patchwork Thu Apr 13 16:55:50 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: 9679743 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 96F9360381 for ; Thu, 13 Apr 2017 16:56:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 892852869B for ; Thu, 13 Apr 2017 16:56:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E0E8286A7; Thu, 13 Apr 2017 16:56:12 +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 231A72869B for ; Thu, 13 Apr 2017 16:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754633AbdDMQ4K (ORCPT ); Thu, 13 Apr 2017 12:56:10 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34490 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754121AbdDMQ4F (ORCPT ); Thu, 13 Apr 2017 12:56:05 -0400 Received: by mail-wr0-f196.google.com with SMTP id u18so9431649wrc.1 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=eu+/YQs3nIcxKty7wTdKEu+8GgfW5SKNKDD63Vtr/ew=; b=QpwcIJlWFu3bjvdCn/nd7n4SuawD9na1rE3xKjsYd3jlGvHlSOJlcR/uVCCh0TZe5K 6AgOXWBJgwu0Y3Xm6WNNz0cJZ5L0dtwRa9Rp02ROGZrD3uaxE2HpAoSHfVMKHArUMP6U E3MjrZk9Q76n6f0OwPyWSViVGN0WtClo98OT5rhxqz8NxvlF6sKPsUwY58jjHECvBo9K Z+egmSICi3MfVhowgndGPlA1KDiR4tQ68U+bEr7XUgussAIwfKWVXt5WAE4HVhYJaxX4 d0nWNNCB6dw7jajby5RSNsU/EHWm0iMfy6nTfn4opl7dh0RhV0ewIZoURfUQTqIMPwpV gcYA== 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=eu+/YQs3nIcxKty7wTdKEu+8GgfW5SKNKDD63Vtr/ew=; b=pa9TfH/fS547cV6xKZJNZRhuHbZY4JXwN7Wux9UlHF7Xb7uClSB2430mgh2zA0xgWE IGJPeRprPw8S7EsIqipmcmBscw95IUl0ZuCuG6Mx/QnFGSC6iJaZSx7htQb8NpaUlk1Q zi/9MqwyZYDkyfzf39MrPXCDCbBf+HKhz4g/pOGLLauyBP1CUq30DxOD5+CdrsCOPlFd wmC40MneU99uyuqSAGctrnSDCMQh+ADg3Z89r3tbTrZYar8KSQn5aRnq/je1ZW+p2M6/ acmUVxROm4ko/+gS5mK2vEQ59FzqPAGpbqjIkvoVZiQj5w6l5uz72i4D3lcWCUTeA5Vd 4zUg== X-Gm-Message-State: AN3rC/7+r6sqVspeScFdGMUbIjU7DgF6qOA9vzlibEaTUvktmluwJVL6 wUK9TKcAEGf5lw== X-Received: by 10.223.172.83 with SMTP id v77mr4062208wrc.112.1492102564178; Thu, 13 Apr 2017 09:56:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 09:56:03 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH 7/8] check duplicated phi-nodes directly on dominators Date: Thu, 13 Apr 2017 18:55:50 +0200 Message-Id: <20170413165551.2785-8-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 Now that add_load_dominators() is integrated into rewrite_load_instruction() we can check for duplicated phi sources directly in the dominators list instead to have to check the corresponding phi sources. This is a preparatory step for the next patch where unneeded phi sources are not created anymore. Signed-off-by: Luc Van Oostenryck --- flow.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/flow.c b/flow.c index b64a3f74a..d705abe2e 100644 --- a/flow.c +++ b/flow.c @@ -439,6 +439,7 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list struct ident *ident) { struct pseudo_list *dominators; + struct instruction *dom; pseudo_t new, phi; dominators = add_load_dominators(insn, doms, ident); @@ -447,12 +448,12 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list * Check for somewhat common case of duplicate * phi nodes. */ - new = first_pseudo(dominators)->def->src1; - FOR_EACH_PTR(dominators, phi) { - if (new != phi->def->src1) + new = first_instruction(doms)->target; + FOR_EACH_PTR(doms, dom) { + if (new != dom->target) goto complex_phi; - new->ident = new->ident ? : phi->ident; - } END_FOR_EACH_PTR(phi); + new->ident = new->ident ? : ident ? : dom->target->ident; + } END_FOR_EACH_PTR(dom); /* * All the same pseudo - mark the phi-nodes unused