[RFC,mainline] PR21596 df bug: global regs should have a def on entry?

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Wed Mar 7 09:37:00 GMT 2007


Andrew MacLeod wrote:
> I was working on a a patch for PR 21596, and it seems to have triggered
> a bug in fwprop on x86 in mainline.

This seems to be a bug in dataflow instead.  It looks to me like we
should add a def on entry for the global registers -- in this case
%edi -- like we add a use on exit.

This patch does this (bootstrap/regtest in progress, but I solicit
comments now just to understand if it is the right approach).  Does
it look ok?

Unfortunately, it undoes the effort of your patch, which does not
fix the PR anymore.  I haven't seen if df-branch fixes the PR in
other ways, nor if it already includes this bugfix.

Paolo


2007-03-07  Paolo Bonzini  <bonzini@gnu.org>

	* df-scan.c (df_record_entry_block_defs): Add artificial defs
	for global registers.

Index: ../../base-gcc-src/gcc/df-scan.c
===================================================================
--- ../../base-gcc-src/gcc/df-scan.c    (revision 122624)
+++ ../../base-gcc-src/gcc/df-scan.c    (working copy)
@@ -1833,6 +1833,13 @@ df_record_entry_block_defs (struct dataf
 #endif
     }

+  /* Mark all global registers as being defined at the entry of the
+     function since values set by our caller should not be treated as
+     uninitialized.  */
+  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+    if (global_regs[i])
+      bitmap_set_bit (df->entry_block_defs, i);
+  
   /* Once the prologue has been generated, all of these registers
      should just show up in the first regular block.  */
   if (HAVE_prologue && epilogue_completed)



More information about the Gcc-patches mailing list