From patchwork Wed Jul 19 11:43:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9851731 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 C5732602BD for ; Wed, 19 Jul 2017 11:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B072428634 for ; Wed, 19 Jul 2017 11:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A51A528643; Wed, 19 Jul 2017 11:43:37 +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_SIGNED, 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 98E7B28642 for ; Wed, 19 Jul 2017 11:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753514AbdGSLnf (ORCPT ); Wed, 19 Jul 2017 07:43:35 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36438 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753465AbdGSLn0 (ORCPT ); Wed, 19 Jul 2017 07:43:26 -0400 Received: by mail-pg0-f65.google.com with SMTP id y129so6606550pgy.3 for ; Wed, 19 Jul 2017 04:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=zi+8bmgGS0RrwlW8DL1pcMFc+likU8iLoxc/heLE8tQ=; b=qTYkl6M3WSWYzpXnjmAumMXYimaS7eMU92Okd7qUiZNYQIlQDn0CqZGzmDutLNZRzG jnvtaqVQpFVFzwuFSoO7W7JezF/y4fHJWyCAR7YWIIuAiHlRcUTeQFwyH6IX2eNdAqVU QkRPK+Pvv3z1wov31znAWD8Ky04XUNIPtSz5LORMSPJOLMqEWRx48rFg9FD2Wh/1XXRz uJJmhGXytsELT9LiPDCQ5HQ5u8nLS0THlRmOxBMYZBrml9irnFgvJTdVHczZMXvAt0Zw 3nyKHQZAPs4UmazsS/ETKTj0T/4i2eFGL7nDZAZBbrwN9sw77MPyAgzjjhd5V3eZm0nb Wwbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=zi+8bmgGS0RrwlW8DL1pcMFc+likU8iLoxc/heLE8tQ=; b=MwsUXjOQs2SCGDm3LynF21tyibyecjfb6/mcYFHvsasAh59pxryqeHCG2hte/mGkrn fsRxVe8uICTqYCtHJoTx83Ybgb0NxgkEZIoTDFS5BkTPYi5qOEt1kTqUqAUct1GH5Cah CsPjDZ2uz/SabiutMm25+o/2J7wPZk2RExWSZisUU16ImINllxgV5shw4Tv9OQkBxEuk UGWgAex33PCLFL8CYNQF5WcFQkRvQ2E9wP863u8WEeFoCyI0KRRrw0UQBlzZ2vv8sFYC VrQT1htFwM738V/izTSbOXXOP4r3p/9omjyJccu+k0ywhUGaCTWrI6LQjmCaVKuTmzhG i/Xg== X-Gm-Message-State: AIVw110oXJPIr3c1/A4aiTTxQ8aSR3DwKSFqG3djLvBz2Sf5tm0mgNrH yJWazNqlRnFX0XJBhIZzUapF1ce6y6ba X-Received: by 10.99.63.206 with SMTP id m197mr2570415pga.170.1500464605197; Wed, 19 Jul 2017 04:43:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.149.130 with HTTP; Wed, 19 Jul 2017 04:43:24 -0700 (PDT) From: Christopher Li Date: Wed, 19 Jul 2017 07:43:24 -0400 X-Google-Sender-Auth: O2oV7LWX7bvsWxHJhqO7HsphuEo Message-ID: Subject: [PATCH] temporary revert commit 11b1a83b d7985338 cause deadloop To: Linux-Sparse , Luc Van Oostenryck , Michael Stefaniuc 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 Michael Stefaniuc report that sparse deadloop on one of the wine source file. The minimal test case to reproduced the deadloop has been add to validation as "kill-unreachable-phi.c". The change that introduce the deadloop can be trace back to 11b1a83b "fix OP_PHI usage in try_to_simplify_bb()" and later d7985338 "fix OP_PHI usage in try_to_simplify_bb() only when non-bogus" Temporary revert the change to avoid the deadloop. The revert cause one of the test case fail because some phi related optimization was not done. I set that test case to known to fail. Reported-by: Michael Stefaniuc Signed-off-by: Christopher Li --- flow.c | 16 +++++++--------- validation/kill-phi-ttsbb.c | 1 + validation/kill-unreachable-phi.c | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 validation/kill-unreachable-phi.c diff --git a/flow.c b/flow.c index bfe54f7..4ff6745 100644 --- a/flow.c +++ b/flow.c @@ -119,14 +119,6 @@ static int try_to_simplify_bb(struct basic_block *bb, struct instruction *first, { int changed = 0; pseudo_t phi; - int bogus; - - /* - * This a due to improper dominance tracking during - * simplify_symbol_usage()/conversion to SSA form. - * No sane simplification can be done when we have this. - */ - bogus = bb_list_size(bb->parents) != pseudo_list_size(first->phi_list); FOR_EACH_PTR(first->phi_list, phi) { struct instruction *def = phi->def; @@ -156,8 +148,14 @@ static int try_to_simplify_bb(struct basic_block *bb, struct instruction *first, continue; changed |= rewrite_branch(source, &br->bb_true, bb, target); changed |= rewrite_branch(source, &br->bb_false, bb, target); - if (changed && !bogus) + /* + * FIXME: change 11b1a83 cause deadloop on wine compile, + * disable for now. + */ +#if 0 + if (changed) kill_use(THIS_ADDRESS(phi)); +#endif } END_FOR_EACH_PTR(phi); return changed; } diff --git a/validation/kill-phi-ttsbb.c b/validation/kill-phi-ttsbb.c index 178a65d..b05c4c2 100644 --- a/validation/kill-phi-ttsbb.c +++ b/validation/kill-phi-ttsbb.c @@ -22,6 +22,7 @@ static int foo(int a, int b) * Verify if OP_PHI usage is adjusted after successful try_to_simplify_bb() * check-command: test-linearize $file * check-output-ignore + * check-known-to-fail * * check-output-excludes: phi\\. * check-output-excludes: phisrc\\. diff --git a/validation/kill-unreachable-phi.c b/validation/kill-unreachable-phi.c new file mode 100644 index 0000000..4c7e249 --- /dev/null +++ b/validation/kill-unreachable-phi.c @@ -0,0 +1,27 @@ +extern char *strcpy (char *__dest, const char *__src); + +static void test_menu_iteminfo( void ) +{ + int ansi = 1; + void *init, *string; + char initA[]="XYZ"; + char stringA[0x80]; + do { + if(ansi) { + string=stringA; + init = initA; + } + if(ansi) + strcpy( string, init ); + } while( !(ansi = !ansi) ); +} +/* + * check-name: kill-unreachable-phi + * check-description: + * In wine source tests/menu.c + * Improper killing a phi instruction inside not reachable BB cause + * dead loop on sparse. + * + * check-output-ignore + * + */