public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90
       [not found] ` <20070716232625.9422.qmail@sourceware.org>
@ 2007-07-26 12:06   ` Kenneth Zadeck
  2007-07-26 17:35     ` Seongbae Park (박성배, 朴成培)
  0 siblings, 1 reply; 5+ messages in thread
From: Kenneth Zadeck @ 2007-07-26 12:06 UTC (permalink / raw)
  To: gcc-bugzilla, Bonzini, Paolo, Park, Seongbae, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

This patch extends the fix in
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01557.html
to handle the case of clobbers inside conditional calls.

This problem caused the regression of gfortran.dg/matmul_3.f90 on the
ia-64 in addition to the regression cited in this pr.

Tested on ppc-32, ia-64 and x86-64.

2007-07-26  Kenneth Zadeck <zadeck@naturalbridge.com>

    PR middle-end/32749
   
    * df-problems.c (df_note_bb_compute): Handle case of clobber
    inside conditional call.  
   

ok to commit?

kenny

[-- Attachment #2: notes3.diff --]
[-- Type: text/x-patch, Size: 512 bytes --]

Index: df-problems.c
===================================================================
--- df-problems.c	(revision 126918)
+++ df-problems.c	(working copy)
@@ -3989,7 +3989,7 @@ df_note_bb_compute (unsigned int bb_inde
 	      /* However a may or must clobber still needs to kill the
 		 reg so that REG_DEAD notes are later placed
 		 appropriately.  */ 
-	      else 
+	      else if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
 		bitmap_clear_bit (live, DF_REF_REGNO (def));
 	    }
 	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90
  2007-07-26 12:06   ` [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90 Kenneth Zadeck
@ 2007-07-26 17:35     ` Seongbae Park (박성배, 朴成培)
  2007-07-26 17:55       ` Kenneth Zadeck
  0 siblings, 1 reply; 5+ messages in thread
From: Seongbae Park (박성배, 朴成培) @ 2007-07-26 17:35 UTC (permalink / raw)
  To: Kenneth Zadeck; +Cc: gcc-bugzilla, Bonzini, Paolo, gcc-patches

On 7/26/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
> This patch extends the fix in
> http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01557.html
> to handle the case of clobbers inside conditional calls.
>
> This problem caused the regression of gfortran.dg/matmul_3.f90 on the
> ia-64 in addition to the regression cited in this pr.
>
> Tested on ppc-32, ia-64 and x86-64.
>
> 2007-07-26  Kenneth Zadeck <zadeck@naturalbridge.com>
>
>     PR middle-end/32749
>
>     * df-problems.c (df_note_bb_compute): Handle case of clobber
>     inside conditional call.
>
> ok to commit?

This change is OK.
Though I wonder if we need to do similar checking
for the regular insn case below.
-- 
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90
  2007-07-26 17:35     ` Seongbae Park (박성배, 朴成培)
@ 2007-07-26 17:55       ` Kenneth Zadeck
  2007-07-26 18:47         ` Seongbae Park (박성배, 朴成培)
  0 siblings, 1 reply; 5+ messages in thread
From: Kenneth Zadeck @ 2007-07-26 17:55 UTC (permalink / raw)
  To: "Seongbae Park (???, ???)"
  Cc: gcc-bugzilla, Bonzini, Paolo, gcc-patches

Seongbae Park (???, ???) wrote:
> On 7/26/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
>> This patch extends the fix in
>> http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01557.html
>> to handle the case of clobbers inside conditional calls.
>>
>> This problem caused the regression of gfortran.dg/matmul_3.f90 on the
>> ia-64 in addition to the regression cited in this pr.
>>
>> Tested on ppc-32, ia-64 and x86-64.
>>
>> 2007-07-26 Kenneth Zadeck <zadeck@naturalbridge.com>
>>
>> PR middle-end/32749
>>
>> * df-problems.c (df_note_bb_compute): Handle case of clobber
>> inside conditional call.
>>
>> ok to commit?
>
> This change is OK.
> Though I wonder if we need to do similar checking
> for the regular insn case below.
No the checking is done in df_create_unused_note. The only reason you
have to do it here is that you are not calling that.

thanks

kenny

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90
  2007-07-26 17:55       ` Kenneth Zadeck
@ 2007-07-26 18:47         ` Seongbae Park (박성배, 朴成培)
  0 siblings, 0 replies; 5+ messages in thread
From: Seongbae Park (박성배, 朴成培) @ 2007-07-26 18:47 UTC (permalink / raw)
  To: Kenneth Zadeck; +Cc: gcc-bugzilla, Bonzini, Paolo, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

On 7/26/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
> Seongbae Park (???, ???) wrote:
> > On 7/26/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
> >> This patch extends the fix in
> >> http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01557.html
> >> to handle the case of clobbers inside conditional calls.
> >>
> >> This problem caused the regression of gfortran.dg/matmul_3.f90 on the
> >> ia-64 in addition to the regression cited in this pr.
> >>
> >> Tested on ppc-32, ia-64 and x86-64.
> >>
> >> 2007-07-26 Kenneth Zadeck <zadeck@naturalbridge.com>
> >>
> >> PR middle-end/32749
> >>
> >> * df-problems.c (df_note_bb_compute): Handle case of clobber
> >> inside conditional call.
> >>
> >> ok to commit?
> >
> > This change is OK.
> > Though I wonder if we need to do similar checking
> > for the regular insn case below.
> No the checking is done in df_create_unused_note. The only reason you
> have to do it here is that you are not calling that.
>
> thanks

Now that I look at df_create_unused_note,
this patch smells a bit - because the condition
inside the for loop looks identical to df_create_unused_node.
I think it would be cleaner if we split the live vector update
into a separate function. i.e. attached patch (untested).
-- 
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"

[-- Attachment #2: pr32749.patch --]
[-- Type: text/x-patch, Size: 3899 bytes --]

diff -r e66ebfebdadc gcc/df-problems.c
--- a/gcc/df-problems.c	Wed Jul 25 18:14:57 2007 +0000
+++ b/gcc/df-problems.c	Thu Jul 26 10:55:48 2007 -0700
@@ -3835,37 +3835,14 @@ df_set_dead_notes_for_mw (rtx insn, rtx 
   return old;
 }
 
-
-/* Create a REG_UNUSED note if necessary for DEF in INSN updating LIVE
-   and DO_NOT_GEN.  Do not generate notes for registers in artificial
-   uses.  */
-
-static rtx
-df_create_unused_note (rtx insn, rtx old, struct df_ref *def, 
-		       bitmap live, bitmap do_not_gen, bitmap artificial_uses)
+/*
+ * Update the live vector given a def.
+ */
+
+static void
+df_update_live_with_def (struct df_ref *def, bitmap live, bitmap do_not_gen)
 {
   unsigned int dregno = DF_REF_REGNO (def);
-  
-#ifdef REG_DEAD_DEBUGGING
-  if (dump_file)
-    {
-      fprintf (dump_file, "  regular looking at def ");
-      df_ref_debug (def, dump_file);
-    }
-#endif
-
-  if (!(bitmap_bit_p (live, dregno)
-	|| (DF_REF_FLAGS (def) & DF_REF_MW_HARDREG)
-	|| bitmap_bit_p (artificial_uses, dregno)
-	|| df_ignore_stack_reg (dregno)))
-    {
-      rtx reg = (DF_REF_LOC (def)) 
-                ? *DF_REF_REAL_LOC (def): DF_REF_REG (def);
-      old = df_set_note (REG_UNUSED, insn, old, reg);
-#ifdef REG_DEAD_DEBUGGING
-      df_print_note ("adding 3: ", insn, REG_NOTES (insn));
-#endif
-    }
   
   if (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER + DF_REF_MAY_CLOBBER)))
     bitmap_set_bit (do_not_gen, dregno);
@@ -3873,6 +3850,38 @@ df_create_unused_note (rtx insn, rtx old
   /* Kill this register if it is not a subreg store or conditional store.  */
   if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
     bitmap_clear_bit (live, dregno);
+}
+
+/* Create a REG_UNUSED note if necessary for DEF in INSN updating LIVE
+   and DO_NOT_GEN.  Do not generate notes for registers in artificial
+   uses.  */
+
+static rtx
+df_create_unused_note (rtx insn, rtx old, struct df_ref *def, 
+		       bitmap live, bitmap artificial_uses)
+{
+  unsigned int dregno = DF_REF_REGNO (def);
+  
+#ifdef REG_DEAD_DEBUGGING
+  if (dump_file)
+    {
+      fprintf (dump_file, "  regular looking at def ");
+      df_ref_debug (def, dump_file);
+    }
+#endif
+
+  if (!(bitmap_bit_p (live, dregno)
+	|| (DF_REF_FLAGS (def) & DF_REF_MW_HARDREG)
+	|| bitmap_bit_p (artificial_uses, dregno)
+	|| df_ignore_stack_reg (dregno)))
+    {
+      rtx reg = (DF_REF_LOC (def)) 
+                ? *DF_REF_REAL_LOC (def): DF_REF_REG (def);
+      old = df_set_note (REG_UNUSED, insn, old, reg);
+#ifdef REG_DEAD_DEBUGGING
+      df_print_note ("adding 3: ", insn, REG_NOTES (insn));
+#endif
+    }
   return old;
 }
 
@@ -3980,17 +3989,13 @@ df_note_bb_compute (unsigned int bb_inde
 	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
 	    {
 	      struct df_ref *def = *def_rec;
+	      /* We don't want to create unused marker for call clobbers. */
 	      if (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
 		old_unused_notes
 		  = df_create_unused_note (insn, old_unused_notes, 
-					   def, live, do_not_gen, 
-					   artificial_uses);
-
-	      /* However a may or must clobber still needs to kill the
-		 reg so that REG_DEAD notes are later placed
-		 appropriately.  */ 
-	      else 
-		bitmap_clear_bit (live, DF_REF_REGNO (def));
+					   def, live, artificial_uses);
+
+	      df_update_live_with_def (def, live, do_not_gen);
 	    }
 	}
       else
@@ -4013,8 +4018,9 @@ df_note_bb_compute (unsigned int bb_inde
 	      struct df_ref *def = *def_rec;
 	      old_unused_notes
 		= df_create_unused_note (insn, old_unused_notes, 
-					 def, live, do_not_gen, 
+					 def, live,
 					 artificial_uses);
+	      df_update_live_with_def (def, live, do_not_gen);
 	    }
 	}
       
@@ -4390,5 +4396,3 @@ df_simulate_one_insn_backwards (basic_bl
   df_simulate_uses (insn, live);
   df_simulate_fixup_sets (bb, live);
 }
-
-

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90
       [not found] ` <20070726115131.30046.qmail@sourceware.org>
@ 2007-07-27 17:39   ` Kenneth Zadeck
  0 siblings, 0 replies; 5+ messages in thread
From: Kenneth Zadeck @ 2007-07-27 17:39 UTC (permalink / raw)
  To: gcc-bugzilla, gcc-patches, Park, Seongbae, Richard Sandiford,
	Bonzini, Paolo

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

This patch rearranges the updating of the local dataflow info when
building reg_dead notes.  The need for this was that processing was not
correctly handled for clobbers that occurred within conditional call
insns.  A rare case but one that at least happens on the ia-64.

This patch not only fixes the regressions listed in pr32749, but also
fixes the gfortran.dg/matmul_3.f90 on the ia-64 regressions. 

This patch was bootstrapped and regression tested yesterday on x86-64
and ia-64 and was again bootstrapped this morning on x86-64 (just to
make sure there were no interactions with richard sandiford's fixes to
closely related code that was just committed.)

Committed as revision 126987.

Kenny

2007-07-26  Kenneth Zadeck <zadeck@naturalbridge.com>

    PR middle-end/32749
   
    * df-problems.c (df_create_unused_note): Removed do_not_gen parm
    and the updating of the live and do_not_gen sets.
    (df_note_bb_compute): Added updating of live and do_not_gen sets
    for regular defs so that the case of clobber inside conditional
    call is processed correctly.
   

[-- Attachment #2: notes5.diff --]
[-- Type: text/x-patch, Size: 3175 bytes --]

Index: df-problems.c
===================================================================
--- df-problems.c	(revision 126979)
+++ df-problems.c	(working copy)
@@ -3868,13 +3868,12 @@ df_set_dead_notes_for_mw (rtx insn, rtx 
 }
 
 
-/* Create a REG_UNUSED note if necessary for DEF in INSN updating LIVE
-   and DO_NOT_GEN.  Do not generate notes for registers in artificial
-   uses.  */
+/* Create a REG_UNUSED note if necessary for DEF in INSN updating
+   LIVE.  Do not generate notes for registers in ARTIFICIAL_USES.  */
 
 static rtx
 df_create_unused_note (rtx insn, rtx old, struct df_ref *def, 
-		       bitmap live, bitmap do_not_gen, bitmap artificial_uses)
+		       bitmap live, bitmap artificial_uses)
 {
   unsigned int dregno = DF_REF_REGNO (def);
   
@@ -3899,12 +3898,6 @@ df_create_unused_note (rtx insn, rtx old
 #endif
     }
   
-  if (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER + DF_REF_MAY_CLOBBER)))
-    bitmap_set_bit (do_not_gen, dregno);
-  
-  /* Kill this register if it is not a subreg store or conditional store.  */
-  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-    bitmap_clear_bit (live, dregno);
   return old;
 }
 
@@ -3915,7 +3908,7 @@ df_create_unused_note (rtx insn, rtx old
 
 static void
 df_note_bb_compute (unsigned int bb_index, 
-		  bitmap live, bitmap do_not_gen, bitmap artificial_uses)
+		    bitmap live, bitmap do_not_gen, bitmap artificial_uses)
 {
   basic_block bb = BASIC_BLOCK (bb_index);
   rtx insn;
@@ -4012,17 +4005,17 @@ df_note_bb_compute (unsigned int bb_inde
 	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
 	    {
 	      struct df_ref *def = *def_rec;
-	      if (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
-		old_unused_notes
-		  = df_create_unused_note (insn, old_unused_notes, 
-					   def, live, do_not_gen, 
-					   artificial_uses);
-
-	      /* However a may or must clobber still needs to kill the
-		 reg so that REG_DEAD notes are later placed
-		 appropriately.  */ 
-	      else 
-		bitmap_clear_bit (live, DF_REF_REGNO (def));
+	      unsigned int dregno = DF_REF_REGNO (def);
+	      if (!DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER))
+		{
+		  old_unused_notes
+		    = df_create_unused_note (insn, old_unused_notes, 
+					     def, live, artificial_uses);
+		  bitmap_set_bit (do_not_gen, dregno);
+		}
+
+	      if (!DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL | DF_REF_CONDITIONAL))
+		bitmap_clear_bit (live, dregno);
 	    }
 	}
       else
@@ -4043,10 +4036,16 @@ df_note_bb_compute (unsigned int bb_inde
 	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
 	    {
 	      struct df_ref *def = *def_rec;
+	      unsigned int dregno = DF_REF_REGNO (def);
 	      old_unused_notes
 		= df_create_unused_note (insn, old_unused_notes, 
-					 def, live, do_not_gen, 
-					 artificial_uses);
+					 def, live, artificial_uses);
+
+	      if (!DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER))
+		bitmap_set_bit (do_not_gen, dregno);
+
+	      if (!DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL | DF_REF_CONDITIONAL))
+		bitmap_clear_bit (live, dregno);
 	    }
 	}
       

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-27 17:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32749-682@http.gcc.gnu.org/bugzilla/>
     [not found] ` <20070716232625.9422.qmail@sourceware.org>
2007-07-26 12:06   ` [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90 Kenneth Zadeck
2007-07-26 17:35     ` Seongbae Park (박성배, 朴成培)
2007-07-26 17:55       ` Kenneth Zadeck
2007-07-26 18:47         ` Seongbae Park (박성배, 朴成培)
     [not found] ` <20070726115131.30046.qmail@sourceware.org>
2007-07-27 17:39   ` Kenneth Zadeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).