Roman Zippel wrote:
> Hi,
>
> On Wed, 20 Jun 2007, Kenneth Zadeck wrote:
>
>   
>> If we add the dead note there we are asserting that the value is
>> modified by the caller. however it might not be and someone could write
>> a piece of asm right after the call to use that reg if the person knew
>> that the reg was not modified by that particular call.
>>     
>
> I have big problems to see this as a valid example, this sounds just 
> broken. First off the user had to know the register was alive before and 
> then the user had to magically know the register isn't clobbered by the 
> call (e.g. loading the address of the function into that register).
> You could declare the variable as asm register variable, then it might 
> work, but then the register wouldn't be available for allocation anyway 
> and the whole problem changes.
>
>   
>> having the dead note there is asserting to the register allocator that
>> they are free to use that reg after the calll in any way that it wants
>> and there is a (small) possibility that is wrong.
>>     
>
> IMO there is nothing wrong with this.
>
> bye, Roman
>   

This patch fixes a problem with creating reg_dead notes.  The code for
actually creating the note for an insn was correct, but the code to
actually propagate the liveness info thru the block in order to create
the notes was defective.  This patch fixes that. 

OK to commit?

2007-06-21  Kenneth Zadeck <[EMAIL PROTECTED]>

        * df-problems.c (df_note_bb_compute): Made computation of live
    info consistent with df_lr.


Index: df-problems.c
===================================================================
--- df-problems.c	(revision 125898)
+++ df-problems.c	(working copy)
@@ -46,6 +46,9 @@ Software Foundation, 51 Franklin Street,
 #include "dce.h"
 #include "vecprim.h"
 
+/* Note that turning REG_DEAD_DEBUGGING on will cause
+   gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints
+   addresses in the dumps.  */  
 #if 0
 #define REG_DEAD_DEBUGGING
 #endif
@@ -3960,8 +3963,8 @@ df_note_bb_compute (unsigned int bb_inde
 	      df_print_regset (dump_file, live);
 	    }
 #endif
-	  /* We only care about real sets for calls.  Clobbers only
-	     may clobbers cannot be depended on.  */
+	  /* We only care about real sets for calls.  Clobbers cannot
+	     be depended on to really die.  */
 	  mws_rec = DF_INSN_UID_MWS (uid);
 	  while (*mws_rec)
 	    {
@@ -3985,6 +3988,11 @@ df_note_bb_compute (unsigned int bb_inde
 		  = df_create_unused_note (insn, old_unused_notes, 
 					   def, live, do_not_gen, 
 					   artificial_uses);
+
+	      /* However a may or must clobber still still needs to
+		 kill the reg.  */ 
+	      else 
+		bitmap_clear_bit (live, DF_REF_REGNO (def));
 	    }
 	}
       else

Reply via email to