This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
- From: "bonzini at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Dec 2011 14:04:04 +0000
- Subject: [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
- Auto-submitted: auto-generated
- References: <bug-51447-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447
--- Comment #5 from Paolo Bonzini <bonzini at gnu dot org> 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);