From patchwork Wed Feb 8 15:01:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 140150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 99B6AB6F62 for ; Thu, 9 Feb 2012 02:02:24 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329318144; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=KtWIwyg vgtJ+ufwESHllT31Vg7M=; b=LxAf/yivYEIavV9ruNO5shO+lvfRagF1bxOvSn5 /CnHkMQ0/De4zcYyWFlgZz7NikV9ajaRPML3snvzZEy+EyO/O+Xa1ie70f+7gxL3 q6MiYc2UDOPbNNXcZIFXp73M20Ph29RnkDvvL5B+OcGH0z0gut1jiIVSig5qLz+N OzA8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Xd6uyq04deaBd4DORZEz0X45TOZ3n30DmI56nIvBc7U6iikM9fn+lSBD1I6h2g LyTomc9M23SZwopWdQAhYkn8emRfBLm/87qmOIIEuyK2DFdlmapuSv5gljcfRTyn oUHDDl+l/dVxOY91XvcOXUGlFOp6bS3mXpGZ7QoGNDvBE=; Received: (qmail 4111 invoked by alias); 8 Feb 2012 15:02:17 -0000 Received: (qmail 4092 invoked by uid 22791); 8 Feb 2012 15:02:15 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM, SUBJ_OBFU_PUNCT_FEW X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Feb 2012 15:02:02 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Rv921-0007Il-HM from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Wed, 08 Feb 2012 07:02:01 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Feb 2012 07:02:01 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Wed, 8 Feb 2012 15:01:58 +0000 Message-ID: <4F328E64.3060601@codesourcery.com> Date: Wed, 8 Feb 2012 16:01:56 +0100 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110920 Lightning/1.0b3pre Thunderbird/3.1.12 MIME-Version: 1.0 To: GCC Patches Subject: haifa-sched: Fix problems with cc0 in prune_ready_list 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 We found a scheduler problem while testing Coldfire targets. The prune_ready_list function I introduced doesn't take SCHED_GROUPs into account, which can lead to a random insn being scheduled between a cc0 setter and user. The patch below fixes it, OK? (Bootstrapped & tested i686-linux). Bernd * haifa-sched.c (prune_ready_list): Ensure that if there is a sched-group insn, it either remains alone or the entire list is pruned. Index: gcc/haifa-sched.c =================================================================== --- gcc/haifa-sched.c (revision 357962) +++ gcc/haifa-sched.c (working copy) @@ -3959,6 +3959,7 @@ prune_ready_list (state_t temp_state, bo bool shadows_only_p, bool modulo_epilogue_p) { int i; + bool sched_group_found = false; restart: for (i = 0; i < ready.n_ready; i++) @@ -3967,13 +3968,27 @@ prune_ready_list (state_t temp_state, bo int cost = 0; const char *reason = "resource conflict"; - if (modulo_epilogue_p && !DEBUG_INSN_P (insn) - && INSN_EXACT_TICK (insn) == INVALID_TICK) + if (DEBUG_INSN_P (insn)) + continue; + + if (SCHED_GROUP_P (insn) && !sched_group_found) + { + sched_group_found = true; + if (i > 0) + goto restart; + } + + if (sched_group_found && !SCHED_GROUP_P (insn)) + { + cost = 1; + reason = "not in sched group"; + } + else if (modulo_epilogue_p && INSN_EXACT_TICK (insn) == INVALID_TICK) { cost = max_insn_queue_index; reason = "not an epilogue insn"; } - if (shadows_only_p && !DEBUG_INSN_P (insn) && !SHADOW_P (insn)) + else if (shadows_only_p && !SHADOW_P (insn)) { cost = 1; reason = "not a shadow";