From patchwork Sat Jul 29 23:58: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: 9870175 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 5E008601D2 for ; Sat, 29 Jul 2017 23:58:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4798727F4B for ; Sat, 29 Jul 2017 23:58:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B56027F7F; Sat, 29 Jul 2017 23:58:59 +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 B1FFF27F4B for ; Sat, 29 Jul 2017 23:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209AbdG2X65 (ORCPT ); Sat, 29 Jul 2017 19:58:57 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33714 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbdG2X65 (ORCPT ); Sat, 29 Jul 2017 19:58:57 -0400 Received: by mail-wm0-f68.google.com with SMTP id q189so20415031wmd.0 for ; Sat, 29 Jul 2017 16:58:56 -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=+cdYG5RnipXiZZeNWCkb7rn+dAS94jsR1VL+p5rFKOk=; b=qBn5AFWlYxQWfLREko9EDZZnTMOq120gTquty/kt7prQfH0ssL8IsX+LgL525Yp1x7 wEla1pakd49d5elYjvxcGWVEHYKFShsn8qmo1dKx1+EjOcnS+uSavk4xCbQq8wcXrb5b dS2QzU1gisy67+GARWitRlaO2itFHnJuAdVLEQGoAKf4Hk4wdCtvPm9t/BDzz9Df9vAz 6w16dzV4rK/IQq0fa2v6c2ILTpGcIdBNOP2xXs/e5DuvI3j9USiYxNBJAKs+jBddzjKW wUYUZHtYwElU+c8R0viNgxsl5s5du1yaPgf/nkCVMct1xvEW2+JzsSO8YM71urUfvYa0 ieaQ== 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=+cdYG5RnipXiZZeNWCkb7rn+dAS94jsR1VL+p5rFKOk=; b=TUd21RCNM/WPdYZSN+1PA9OWq8Hp74g2N+5E96k9e9Ufc9dkTW9XouTkyXmdIm0O6c I2dCfLMc34udiuz/aCsa/+/HBU64QORW4iauVVMsVI1tCsV7IMr8e0Zb3IWtCRArEdQr EXpLM4ftZCt7SzrBNLEM0ksWKsrAdgHEpF/HDQ2yT8wpZsxlb7/hlvaHtIQEgNUNPRhP h5zOxlIbU2XHAM7+wTyclrDmPoD21FLWjgMavQj1h+uXgD93r2uYREnOR+nHrayW96J7 gEDsn8E7ErP/x+iGj0O/LLyY3/Ly/ME8FbVZkcN8bgcPYcfrLYioyuu0xi4sc4CvzReB nhRw== X-Gm-Message-State: AIVw11187HfiCsEFDQFSiVDNAwBnE78vAOjjPDqBQlS2/FkX+uC9GKLx +9aSI3rZY3mV1Q== X-Received: by 10.28.157.81 with SMTP id g78mr8779348wme.76.1501372736116; Sat, 29 Jul 2017 16:58:56 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:40c4:ab00:5c64:7a30:d37f:ecab]) by smtp.gmail.com with ESMTPSA id f47sm28673956wrf.78.2017.07.29.16.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Jul 2017 16:58:55 -0700 (PDT) From: Luc Van Oostenryck To: Christopher Li Cc: Michael Stefaniuc , linux-sparse@vger.kernel.org, Luc Van Oostenryck Subject: [PATCH] fix: try_to_simplify_bb eargerness part 2 Date: Sun, 30 Jul 2017 01:58:50 +0200 Message-Id: <20170729235850.22180-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170729233805.lvdhpk5bnyaj5zq6@ltop.local> References: <20170729233805.lvdhpk5bnyaj5zq6@ltop.local> 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 is a temptative patch for the wine infinitive loop. --- flow.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flow.c b/flow.c index d8198ce8d..fe16d78d4 100644 --- a/flow.c +++ b/flow.c @@ -79,6 +79,19 @@ static int bb_depends_on(struct basic_block *target, struct basic_block *src) return 0; } +/* + * This is only to be used by try_to_simplify_bb(). + * It really should be handled by bb_depends_on(), only + * that there is no liveness done on OP_PHI/OP_PHISRC. + * bb_depends_on() should return true if a phi + * is defined by src and used by target but it doesn't. + * So for now we add the explicit check. + */ +static int bb_uses_phi(struct basic_block *target, pseudo_t phi) +{ + return pseudo_in_list(target->needs, phi); +} + /* * This is only to be used by try_to_simplify_bb(). * It really should be handled by bb_depends_on(), only @@ -152,6 +165,8 @@ static int try_to_simplify_bb(struct basic_block *bb, struct instruction *first, target = true ? second->bb_true : second->bb_false; if (bb_depends_on(target, bb)) continue; + if (bb_uses_phi(target, first->target)) + continue; if (bb_defines_phi(bb, first)) continue; changed |= rewrite_branch(source, &br->bb_true, bb, target);