From patchwork Wed Aug 6 15:47:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 377059 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B097F14009C for ; Thu, 7 Aug 2014 01:48:18 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=gCsA/o4AiQ3r+zk72lHzzrzxURFhr/uHPGURdJUnK/lUDz Lrdf0aIO0RFap6mGRRjWtqH8dGFjiG/4kZgg7Jhfei7vJSImbXe/NHDTbXpP1oyL LccL5m3ZbnjOJnWRc2zuYAwGlhSmLzu4VMUpk/0Q/xn8GcsVldwVwKe58v4Nw= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=9gPu9uG2Wk9uUPbrBlIr/o6av18=; b=V2RpVrFzWC3BL8/eenDc pV0lfEAzJsILyq0ba+oLpag3zAv7IHlX9MBsMX886ho+/3bbPvrAM/uVQZstSFNf zrz7RNgdKWcTdk92iHSWA2vdbjVujUK0JuczNLeC2SD0HN4Zk9HoWjEdcoPPg6/J yAMJlUyudpXwF05z13ws2YM= Received: (qmail 9868 invoked by alias); 6 Aug 2014 15:48:12 -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 9848 invoked by uid 89); 6 Aug 2014 15:48:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 15:48:09 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76Fm8NT028696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 11:48:08 -0400 Received: from Mair.local (vpn-54-209.rdu2.redhat.com [10.10.54.209]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76Fm6cU008671 for ; Wed, 6 Aug 2014 11:48:07 -0400 Message-ID: <53E24E24.4070003@redhat.com> Date: Wed, 06 Aug 2014 11:47:48 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR 61923 X-IsSubscribed: yes The following patch fixes PR61923. The details of the problem can be found on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61923 The patch was tested and bootstrapped on x86/x86-64. The patch has been committed as rev. 213674 to gcc-4.9 branch and as rev. 213675 to the trunk. 2014-08-06 Vladimir Makarov PR debug/61923 * haifa-sched.c (advance_one_cycle): Fix dump. (schedule_block): Don't advance cycle if we are already at the beginning of the cycle. 2014-08-06 Vladimir Makarov PR debug/61923 * gcc.target/i386/pr61923.c: New test. Index: haifa-sched.c =================================================================== --- haifa-sched.c (revision 213643) +++ haifa-sched.c (working copy) @@ -2972,7 +2972,7 @@ advance_one_cycle (void) { advance_state (curr_state); if (sched_verbose >= 6) - fprintf (sched_dump, ";;\tAdvanced a state.\n"); + fprintf (sched_dump, ";;\tAdvance the current state.\n"); } /* Update register pressure after scheduling INSN. */ @@ -6007,6 +6007,7 @@ schedule_block (basic_block *target_bb, modulo_insns_scheduled = 0; ls.modulo_epilogue = false; + ls.first_cycle_insn_p = true; /* Loop until all the insns in BB are scheduled. */ while ((*current_sched_info->schedule_more_p) ()) @@ -6077,7 +6078,6 @@ schedule_block (basic_block *target_bb, if (must_backtrack) goto do_backtrack; - ls.first_cycle_insn_p = true; ls.shadows_only_p = false; cycle_issued_insns = 0; ls.can_issue_more = issue_rate; @@ -6363,11 +6363,13 @@ schedule_block (basic_block *target_bb, break; } } + ls.first_cycle_insn_p = true; } if (ls.modulo_epilogue) success = true; end_schedule: - advance_one_cycle (); + if (!ls.first_cycle_insn_p) + advance_one_cycle (); perform_replacements_new_cycle (); if (modulo_ii > 0) { Index: testsuite/gcc.target/i386/pr61923.c =================================================================== --- testsuite/gcc.target/i386/pr61923.c (revision 0) +++ testsuite/gcc.target/i386/pr61923.c (working copy) @@ -0,0 +1,36 @@ +/* PR debug/61923 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +typedef struct +{ + struct + { + struct + { + char head; + } tickets; + }; +} arch_spinlock_t; +struct ext4_map_blocks +{ + int m_lblk; + int m_len; + int m_flags; +}; +int ext4_da_map_blocks_ei_0; +void fn1 (int p1, struct ext4_map_blocks *p2) +{ + int ret; + if (p2->m_flags) + { + ext4_da_map_blocks_ei_0++; + arch_spinlock_t *lock; + switch (sizeof *&lock->tickets.head) + case 1: + asm("" : "+m"(*&lock->tickets.head) : ""(0)); + __asm__(""); + ret = 0; + } + fn2 (p2->m_lblk, p2->m_len); +}