From patchwork Wed Oct 10 16:03:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 981977 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-487272-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="eDhEgMAF"; 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 42Vf5q6789z9sB7 for ; Thu, 11 Oct 2018 03:03:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:date:mime-version:content-type:message-id; q=dns; s= default; b=AN9F8Akdr2LwcSMJGXB0iMzZGbnK9hppmAYIPFaDWYlQzb1gyPk6F yWWjfdKpjCRphM0p8HZPFa4C5pnkO86e/vCdRS7gLFN/orDHUB784d9kxVf1mFkU tktHTXfKsanqXvo+HW0VJiLchi/V79lh2pRsnFuIz7QGiFsE6K15Ew= 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:from :subject:to:date:mime-version:content-type:message-id; s= default; bh=8tr9z2h8HKwsqeV8+uasj5eW18c=; b=eDhEgMAFhqY0BVmICcNx oSnN5EBTrm7jw47TwNSoNVbiblk5jfdCjCMNi9Hb9EPn4x0LgeUF5IahzFfTwtg/ VCG1IMms0YTOUIxP+CREZTFu96wR5Av6g9ClPN9DjcSc+DwukdB5Ptzwpq6mAR12 CiV0dtQOM/3EbtFHfFlFx8E= Received: (qmail 32846 invoked by alias); 10 Oct 2018 16:03:20 -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 32831 invoked by uid 89); 10 Oct 2018 16:03:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:rdappl, U*rdapp, dapp, rdapp@linux.ibm.com X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Oct 2018 16:03:18 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9AFxMKa063367 for ; Wed, 10 Oct 2018 12:03:16 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n1jqhe4f2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Oct 2018 12:03:16 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Oct 2018 17:03:14 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 10 Oct 2018 17:03:13 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9AG3Cmm1966428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Oct 2018 16:03:12 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 609E852051 for ; Wed, 10 Oct 2018 19:02:45 +0100 (BST) Received: from oc6142347168.ibm.com (unknown [9.152.222.61]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 3897E52057 for ; Wed, 10 Oct 2018 19:02:45 +0100 (BST) From: Robin Dapp Subject: [PATCH] Reset insn priority after inc/ref replacement in haifa sched To: GCC Patches Date: Wed, 10 Oct 2018 18:03:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 x-cbid: 18101016-0016-0000-0000-000002113984 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101016-0017-0000-0000-00003268A99C Message-Id: Hi, as my last message (https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00280.html) did not garner much attention, I'm posting it in proper patch form this time. The problem I'm trying to solve is that an insn's priority seems unchanged if the priority of insns that depend on it is changed (and the first insn's priority was computed by on of these dependent insns' priority). If I missed something or there is another way this should be working, I'd like to learn about that. A non-bootstrapped test suite run on s390 showed no regressions and an x86 one is currently running (current HEAD didn't bootstrap for me on x86). The actual code changes throughout SPEC2006 are minor and the performance impact is negligible provided we do not hit a fixable bad case as described in my last message. Regards Robin --- gcc/ChangeLog: 2018-10-10 Robin Dapp * haifa-sched.c (apply_replacement): Reset insn priority after inc/ref replacement. commit 69ade62116eecf0a2bdf1cb099158e6d1dca1f3f Author: Robin Dapp Date: Mon Oct 8 15:26:58 2018 +0200 recompute priority of insn whose dependencies have changed after applying an inc/ref replacement. diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 1fdc9df9fb2..1a7fe7b78e2 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -4713,7 +4713,21 @@ apply_replacement (dep_t dep, bool immediately) success = validate_change (desc->insn, desc->loc, desc->newval, 0); gcc_assert (success); + rtx_insn *insn = DEP_PRO (dep); + + INSN_PRIORITY_STATUS (insn) = -1; + + sd_iterator_def sd_it; + sd_it = sd_iterator_start (insn, SD_LIST_FORW); + while (sd_iterator_cond (&sd_it, &dep)) + { + DEP_COST (dep) = UNKNOWN_DEP_COST; + sd_iterator_next (&sd_it); + } + + priority (insn); update_insn_after_change (desc->insn); + if ((TODO_SPEC (desc->insn) & (HARD_DEP | DEP_POSTPONED)) == 0) fix_tick_ready (desc->insn);