From patchwork Mon Apr 23 14:03:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Belevantsev X-Patchwork-Id: 902960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-476719-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ispras.ru Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OUU9G2DN"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40V7V047Lgz9rxx for ; Tue, 24 Apr 2018 00:03:35 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=hei3xdbqOZYut0O/r QsXpPfzRma06fGfrLWiu7B6Ukh+qfTKhz/n2j3iDNcN8eWrY9Yd4ZmQITxf6jSeo uGQ8mA36pz2DJ+Di9OjLYVlmZzrtk/hYzKVym82KfxNVSNCnuqB9m/A25R//BSec 9RVsFB1p7w1MsfYJPNxvkW6eiY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=jE28g0x2chNsVFAtUdEsJQd WYbA=; b=OUU9G2DN3mGjckqey5Jwohy+qFjfNMXajmy0IpGdXDsFXcku1fV5eVW wuxEEB7oi7hwboStl0sVeJO+/w+njoHZb5CUl+VDi4leTTlMq0H9btJHuOm23opP M0vJOgAzdUQorJS6axBmLQGAxlxv01SWwAjQB2xh/zJrXUdkJ2lo= Received: (qmail 120807 invoked by alias); 23 Apr 2018 14:03:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 120413 invoked by uid 89); 23 Apr 2018 14:03:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=movement, D*ru, Hx-languages-length:1996, H*u:6.1 X-HELO: mail.ispras.ru Received: from mail.ispras.ru (HELO mail.ispras.ru) (83.149.199.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Apr 2018 14:03:19 +0000 Received: from [10.10.3.52] (pluton2.ispras.ru [83.149.199.44]) by mail.ispras.ru (Postfix) with ESMTPSA id B8EC1540081; Mon, 23 Apr 2018 17:03:16 +0300 (MSK) Subject: Fix PR 85423 (Re: Fix PRs 80463, 83972, 83480) From: Andrey Belevantsev To: Alexander Monakov Cc: GCC Patches References: <335f9422-2a51-ac54-691c-5ea099164afe@ispras.ru> <33b19bc3-a2fd-b4ff-4376-5bd93c7004d0@ispras.ru> <07578825-47c1-45e7-8750-327997b8ff69@ispras.ru> Openpgp: preference=signencrypt Message-ID: <79a550e3-d3ab-6319-6ae5-0ef20a0286b8@ispras.ru> Date: Mon, 23 Apr 2018 17:03:09 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <07578825-47c1-45e7-8750-327997b8ff69@ispras.ru> X-IsSubscribed: yes Hello, So this PR shows that I have incorrectly mirrored the conditional from sched-deps.c that creates the dependence from a debug insn on the previous insn (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80463#c3 for the hunk). Thus we have incorrectly discarded some legitimate debug-debug dependencies. The straightforward fix works for all of four PRs, tested on x86-64. I have put the test in gcc.dg though it requires -march=nano. Do you want me to create an extra machine-dependent test? Best, Andrey 2018-04-23 Andrey Belevantsev PR rtl-optimization/85423 * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard dependencies to debug insns when previous insn is non-debug. * gcc.dg/pr85423.c: New test. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index ee970522890..85ff5bd3eb4 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -3308,7 +3308,7 @@ has_dependence_note_dep (insn_t pro, ds_t ds ATTRIBUTE_UNUSED) that a bookkeeping copy should be movable as the original insn. Detect that here and allow that movement if we allowed it before in the first place. */ - if (DEBUG_INSN_P (real_con) + if (DEBUG_INSN_P (real_con) && !DEBUG_INSN_P (real_pro) && INSN_UID (NEXT_INSN (pro)) == INSN_UID (real_con)) return; diff --git a/gcc/testsuite/gcc.dg/pr85423.c b/gcc/testsuite/gcc.dg/pr85423.c new file mode 100644 index 00000000000..21d4a2eb4b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr85423.c @@ -0,0 +1,26 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fselective-scheduling2 -fvar-tracking-assignments -fno-guess-branch-probability -fno-peephole2 -fno-ssa-phiopt -fno-tree-pre --param max-jump-thread-duplication-stmts=8 -w" } */ + +int vn, xm; + +void +i1 (int); + +void +mb (int *ap, int ev) +{ + while (vn < 1) + { + i1 (vn); + + ev += *ap && ++vn; + + while (xm < 1) + ++xm; + + if (*ap == 0) + *ap = ev; + + ++vn; + } +}