From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23700 invoked by alias); 7 Dec 2011 14:04:55 -0000 Received: (qmail 23684 invoked by uid 22791); 7 Dec 2011 14:04:54 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Dec 2011 14:04:41 +0000 From: "bonzini at gnu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code Date: Wed, 07 Dec 2011 14:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: bonzini at gnu dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.4.7 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg00750.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447 --- Comment #5 from Paolo Bonzini 2011-12-07 14:04:04 UTC --- Untested patch... Index: df-problems.c =================================================================== --- df-problems.c (revision 177688) +++ df-problems.c (working copy) @@ -901,6 +901,10 @@ df_lr_local_compute (bitmap all_blocks A /* The all-important stack pointer must always be live. */ bitmap_set_bit (&df->hardware_regs_used, STACK_POINTER_REGNUM); + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (global_regs[i]) + bitmap_set_bit (&df->hardware_regs_used, i); + /* Before reload, there are a few registers that must be forced live everywhere -- which might not already be the case for blocks within infinite loops. */ Index: df-scan.c =================================================================== --- df-scan.c (revision 177688) +++ df-scan.c (working copy) @@ -3733,8 +3733,12 @@ df_get_entry_block_def_set (bitmap entry bitmap_clear (entry_block_defs); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (FUNCTION_ARG_REGNO_P (i)) - bitmap_set_bit (entry_block_defs, INCOMING_REGNO (i)); + { + if (global_regs[i]) + bitmap_set_bit (entry_block_defs, i); + if (FUNCTION_ARG_REGNO_P (i)) + bitmap_set_bit (entry_block_defs, INCOMING_REGNO (i)); + } /* The always important stack pointer. */ bitmap_set_bit (entry_block_defs, STACK_POINTER_REGNUM);