From patchwork Sun Sep 2 10:38:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 181176 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 0EDD62C0091 for ; Sun, 2 Sep 2012 20:38:54 +1000 (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=1347187135; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=jJtMWpq 3G0RjURT2k6gc05AtjlM=; b=BoOrPtqKSjw4vsE0EBO5qCBCJaqAWahKMGYXKVJ SzgCr4j1dTWhZtugL6W5d0bWfEkwhvY4H2GCoEpRBWoUaIOKQgDc9YA0sTSVRR+k FQrQuN0jvPwUbC8D6VM+GXH5DynZB+jbFhfdbXCxfmd5kop2E+x/pKZoDkbJKBxi qnQ8= 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:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NvY+55CJ2U+e4mWKqqISIMR2JQHu+OpG6yibdeN9IluWFERPCzbwon+fo3Jgt6 34WVDAp4vUz+RZa4/k7SNkmoo+EkHfi9kLEUDHKaHqRWoxKA0ZGe+uuKfRIv+3tT KzWnMpRY0WY5TB1dtX7/mFMEP6TmTV4pTz6KUOHGyb1PA=; Received: (qmail 25168 invoked by alias); 2 Sep 2012 10:38:51 -0000 Received: (qmail 25159 invoked by uid 22791); 2 Sep 2012 10:38:50 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Sep 2012 10:38:37 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8B4F029003F for ; Sun, 2 Sep 2012 12:38:45 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fbf621jgdutK for ; Sun, 2 Sep 2012 12:38:45 +0200 (CEST) Received: from hermes.site (ADijon-552-1-118-125.w92-148.abo.wanadoo.fr [92.148.61.125]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 625A7290007 for ; Sun, 2 Sep 2012 12:38:45 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR rtl-optimization/54369 Date: Sun, 2 Sep 2012 12:38:35 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.6-desktop; KDE/4.4.4; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201209021238.35386.ebotcazou@adacore.com> 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 This is a wrong code bug at -O2 reported for MIPS and caused by the discrepancy between the natural placement of barriers in the RTL stream and the placement expected by the dbr pass (actually by the delete_related_insns machinery). The MIPS port invokes the dbr pass from its own reorg pass and the prerequisite for the placement of barriers isn't fulfilled in this case. Ironically enough, Richard S. remarked that the SPARC port is plagued by the same problem when its own reorg pass is activated (but that's almost never the case for SPARC). Tested by Steve on MIPS and me on SPARC, approved by Richard for the MIPS part and applied on all active branches. 2012-09-02 Eric Botcazou PR rtl-optimization/54369 * config/mips/mips.c (mips_reorg): Invoke cleanup_barriers before calling dbr_schedule. * config/sparc/sparc.c (sparc_reorg): Likewise. Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 190664) +++ config/sparc/sparc.c (working copy) @@ -10691,7 +10691,10 @@ sparc_reorg (void) /* We need to have the (essentially) final form of the insn stream in order to properly detect the various hazards. Run delay slot scheduling. */ if (optimize > 0 && flag_delayed_branch) - dbr_schedule (get_insns ()); + { + cleanup_barriers (); + dbr_schedule (get_insns ()); + } /* Now look for specific patterns in the insn stream. */ for (insn = get_insns (); insn; insn = next) Index: config/mips/mips.c =================================================================== --- config/mips/mips.c (revision 190664) +++ config/mips/mips.c (working copy) @@ -15647,7 +15647,10 @@ mips_reorg (void) } if (optimize > 0 && flag_delayed_branch) - dbr_schedule (get_insns ()); + { + cleanup_barriers (); + dbr_schedule (get_insns ()); + } mips_reorg_process_insns (); if (!TARGET_MIPS16 && TARGET_EXPLICIT_RELOCS