From patchwork Mon Aug 14 16:04: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: 9899609 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 16D32602BA for ; Mon, 14 Aug 2017 16:05:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04FF126E40 for ; Mon, 14 Aug 2017 16:05:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB86226E56; Mon, 14 Aug 2017 16:05:00 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 89FAD26E40 for ; Mon, 14 Aug 2017 16:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752767AbdHNQE7 (ORCPT ); Mon, 14 Aug 2017 12:04:59 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:32797 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbdHNQE6 (ORCPT ); Mon, 14 Aug 2017 12:04:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id q189so15016739wmd.0 for ; Mon, 14 Aug 2017 09:04:57 -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=ejBPldjuaoAS9rRHwd19LT8HR6bgitHLuP/9CjchJoA=; b=Y1wGMnAUdAUzeSa3ZRe/0ahZlSQZJiib4LhZ5UK4EL6muclj55lzT3iiRZK4O1XJsN GqyxsjK7JMBfsKUxTJSc02kjlMyU0XAdyWNBydN96p+p0UTVld8sp7CBhfHjP3JHxEyb aA0mqkj34G1hrnCHMHLwEa7zyeH3JGNdmYgM6lBcXKAPlzebrFodBz1OAaE65YGi3bjv Kg6aT+1zu/GruZJwcN8lDbGopZD+d0ALOyuPyK/q09FPzVXemykH6W6BzahVVlrqltlf gfM9XUTjY5uq0rLyJjn9aUj+TIaL9L7zzbo0ghoV9R+VHCehdfnIVg+zL0EeXEbywWeL Bi1w== 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=ejBPldjuaoAS9rRHwd19LT8HR6bgitHLuP/9CjchJoA=; b=JabmYQqOTxP1GJKJd6R1smzy7LzwBASzHoTHhNh/nMZ/O/Qp8T8Xu/Kf0rh9J9l2mY /Yj4/zvQbqAitm6Mel4R1proSUuUE4U5Eocbz5G9QorENv2isiAKh7rY6ndvFWhTpMq2 IUZY1Vsj/2dIdYl624eVsgW+QH+MGXkArNFDydfDTglAv/7w7pEO+KxiOYEGcaMszP3J rhGXf7mhL1tL9cDvZQGc4uvMKC14cENspsNLmHOP/7/dT/P/BDzZq4JbTnNHl1hQ0gpg lfcBmpJ3WdggeE5OzgpQtsVGafqOAmXzm99i0WWY+1afz0yoSWLF7D2hDdD6dBJemx/8 EDsQ== X-Gm-Message-State: AHYfb5h5qMkSrrm+kbmtvYqkadzuBq+3OBtrBYghNJNvLFi4ljS67uV0 zSqR3hlmJi4jm8uzNLI= X-Received: by 10.80.190.205 with SMTP id e13mr24127947edk.12.1502726696612; Mon, 14 Aug 2017 09:04:56 -0700 (PDT) Received: from localhost.localdomain (1.84-65-87.adsl-dyn.isp.belgacom.be. [87.65.84.1]) by smtp.gmail.com with ESMTPSA id x53sm5467666edd.79.2017.08.14.09.04.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 09:04:56 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Dibyendu Majumdar , Christopher Li , Luc Van Oostenryck Subject: [PATCH] remove wrong part of simplify_loads() Date: Mon, 14 Aug 2017 18:04:50 +0200 Message-Id: <20170814160450.24348-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.14.0 In-Reply-To: References: 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 Currently simplify_loads() is broken with exactly the same error as in simplify_one_symbol(). The core of the problem is that phi-nodes are stored at the place where the value is needed, where the initial load was, while phi-nodes must be placed where branches meet. Temporary fix this removing this 'simplification'. Note: It's possible to do this a bit less crudely Note: This patch is kinda useless without the SSA construction first fixed.. Signed-off-by: Luc Van Oostenryck --- memops.c | 63 --------------------------------------------------------------- 1 file changed, 63 deletions(-) diff --git a/memops.c b/memops.c index aeacdf566..99430e455 100644 --- a/memops.c +++ b/memops.c @@ -16,51 +16,6 @@ #include "linearize.h" #include "flow.h" -static int find_dominating_parents(pseudo_t pseudo, struct instruction *insn, - struct basic_block *bb, unsigned long generation, struct pseudo_list **dominators, - int local) -{ - struct basic_block *parent; - - FOR_EACH_PTR(bb->parents, parent) { - struct instruction *one; - struct instruction *br; - pseudo_t phi; - - FOR_EACH_PTR_REVERSE(parent->insns, one) { - int dominance; - if (!one->bb) - continue; - if (one == insn) - goto no_dominance; - dominance = dominates(pseudo, insn, one, local); - if (dominance < 0) { - if (one->opcode == OP_LOAD) - continue; - return 0; - } - if (!dominance) - continue; - goto found_dominator; - } END_FOR_EACH_PTR_REVERSE(one); -no_dominance: - if (parent->generation == generation) - continue; - parent->generation = generation; - - if (!find_dominating_parents(pseudo, insn, parent, generation, dominators, local)) - return 0; - continue; - -found_dominator: - br = delete_last_instruction(&parent->insns); - phi = alloc_phi(parent, one->target, one->size); - phi->ident = phi->ident ? : one->target->ident; - add_instruction(&parent->insns, br); - use_pseudo(insn, phi, add_pseudo(dominators, phi)); - } END_FOR_EACH_PTR(parent); - return 1; -} static int address_taken(pseudo_t pseudo) { @@ -91,8 +46,6 @@ static void simplify_loads(struct basic_block *bb) struct instruction *dom; pseudo_t pseudo = insn->src; int local = local_pseudo(pseudo); - struct pseudo_list *dominators; - unsigned long generation; /* Check for illegal offsets.. */ check_access(insn); @@ -117,22 +70,6 @@ static void simplify_loads(struct basic_block *bb) goto next_load; } } END_FOR_EACH_PTR_REVERSE(dom); - - /* OK, go find the parents */ - generation = ++bb_generation; - bb->generation = generation; - dominators = NULL; - if (find_dominating_parents(pseudo, insn, bb, generation, &dominators, local)) { - /* This happens with initial assignments to structures etc.. */ - if (!dominators) { - if (local) { - assert(pseudo->type != PSEUDO_ARG); - convert_load_instruction(insn, value_pseudo(0)); - } - goto next_load; - } - rewrite_load_instruction(insn, dominators); - } } next_load: /* Do the next one */;