This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code


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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]