This is the mail archive of the gcc-patches@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]

Re: [Bug middle-end/32749] [4.3 regression]: gfortran.dg/auto_array_1.f90


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

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