From patchwork Mon Sep 20 21:30:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 65257 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 6ECB7B70CD for ; Tue, 21 Sep 2010 07:32:07 +1000 (EST) Received: (qmail 10563 invoked by alias); 20 Sep 2010 21:32:05 -0000 Received: (qmail 10555 invoked by uid 22791); 20 Sep 2010 21:32:04 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Sep 2010 21:31:59 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D1A24CB0288 for ; Mon, 20 Sep 2010 23:31:57 +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 nm6WG9TJP+Rn for ; Mon, 20 Sep 2010 23:31:57 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id AE7EACB01EB for ; Mon, 20 Sep 2010 23:31:57 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR rtl-optimization/42775 Date: Mon, 20 Sep 2010 23:30:44 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201009202330.44434.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 GCC 4.4.x miscompiles itself on the SPARC at -O1, a regression from earlier series. tree-ssa-operands.c:copy_virtual_operands is miscompiled by delay slot scheduling, aka reorg, because of a dangling REG_EQUAL note. cprop_hardreg turns: (insn 287 286 288 39 pr42775.c:19479 (set (reg/v/f:SI 16 %l0 [orig:152 dest_vdefs ] [152]) (reg:SI 8 %o0)) 50 {*movsi_insn} (expr_list:REG_DEAD (reg:SI 8 %o0) (nil))) [...] (insn 348 347 349 48 pr42775.c:19529 (set (reg:SI 1 %g1 [orig:138 ivtmp.1158 ] [138]) (reg/v/f:SI 16 %l0 [orig:152 dest_vdefs ] [152])) 50 {*movsi_insn} (nil)) into: insn 348: replaced reg 16 with 8 (insn 287 286 288 39 pr42775.c:19479 (set (reg/v/f:SI 16 %l0 [orig:152 dest_vdefs ] [152]) (reg:SI 8 %o0)) 50 {*movsi_insn} (expr_list:REG_DEAD (reg:SI 8 %o0) (nil))) [...] (insn 348 347 349 48 pr42775.c:19529 (set (reg:SI 1 %g1 [orig:138 ivtmp.1158 ] [138]) (reg/f:SI 8 %o0 [orig:152 dest_vdefs ] [152])) 50 {*movsi_insn} (nil)) so the REG_DEAD is now wrong and this fools the algorithm in resource.c. Fixed by recomputing notes when reorg is enabled. Bootstrapped/regtested on SPARC64/Linux and SPARC/Solaris, applied on mainline and 4.5/4.4 branches. 2010-09-20 Eric Botcazou PR rtl-optimization/42775 * cfgrtl.c (rest_of_pass_free_cfg): Recompute notes if delay slot scheduling is enabled. Index: cfgrtl.c =================================================================== --- cfgrtl.c (revision 164451) +++ cfgrtl.c (working copy) @@ -421,7 +421,10 @@ rest_of_pass_free_cfg (void) /* The resource.c machinery uses DF but the CFG isn't guaranteed to be valid at that point so it would be too late to call df_analyze. */ if (optimize > 0 && flag_delayed_branch) - df_analyze (); + { + df_note_add_problem (); + df_analyze (); + } #endif free_bb_for_insn ();