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: [PATCH] Fix i?86 eh regressions (PR middle-end/40304)


On Sun, May 31, 2009 at 09:33:19PM -0700, Ian Lance Taylor wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > 2009-05-31  Jakub Jelinek  <jakub@redhat.com>
> >
> > 	PR middle-end/40304
> > 	* recog.c (peephole2_optimize): When seeing a RTX_FRAME_RELATED_P
> > 	insn, reinitialize peep2_insn_data and peep2_current in addition
> > 	to clearing peep2_current_count.
> >
> > --- gcc/recog.c.jj	2009-05-19 10:51:33.000000000 +0200
> > +++ gcc/recog.c	2009-05-30 21:23:44.000000000 +0200
> > @@ -3118,7 +3118,13 @@ peephole2_optimize (void)
> >  		  /* If an insn has RTX_FRAME_RELATED_P set, peephole
> >  		     substitution would lose the
> >  		     REG_FRAME_RELATED_EXPR that is attached.  */
> > +		  for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
> > +		    peep2_insn_data[i].insn = NULL_RTX;
> >  		  peep2_current_count = 0;
> > +		  peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB;
> > +		  peep2_current = MAX_INSNS_PER_PEEP2;
> > +		  bitmap_copy (peep2_insn_data[peep2_current].live_before,
> > +			       live);
> 
> Put this in a helper function, I think, one that is also called from the
> loop at the start of each block, passing in the live bitmap to use.

Like this?  Bootstrapped/regtested on x86_64-linux and i686-linux:

2009-06-01  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/40316
	* recog.c (peep2_reinit_state): New function.
	(peephole2_init_state): Use it at the end of a basic block and also
	when seeing a RTX_FRAME_RELATED_P insn.

--- gcc/recog.c.jj	2009-05-19 10:51:33.000000000 +0200
+++ gcc/recog.c	2009-06-01 10:06:26.000000000 +0200
@@ -3056,6 +3056,26 @@ peep2_find_free_register (int from, int 
   return NULL_RTX;
 }
 
+/* Forget all currently tracked instructions, only remember current
+   LIVE regset.  */
+
+static void
+peep2_reinit_state (regset live)
+{
+  int i;
+
+  /* Indicate that all slots except the last holds invalid data.  */
+  for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
+    peep2_insn_data[i].insn = NULL_RTX;
+  peep2_current_count = 0;
+
+  /* Indicate that the last slot contains live_after data.  */
+  peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB;
+  peep2_current = MAX_INSNS_PER_PEEP2;
+
+  COPY_REG_SET (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live);
+}
+
 /* Perform the peephole2 optimization pass.  */
 
 static void
@@ -3079,19 +3099,11 @@ peephole2_optimize (void)
   FOR_EACH_BB_REVERSE (bb)
     {
       rtl_profile_for_bb (bb);
-      /* Indicate that all slots except the last holds invalid data.  */
-      for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
-	peep2_insn_data[i].insn = NULL_RTX;
-      peep2_current_count = 0;
-
-      /* Indicate that the last slot contains live_after data.  */
-      peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB;
-      peep2_current = MAX_INSNS_PER_PEEP2;
 
       /* Start up propagation.  */
       bitmap_copy (live, DF_LR_OUT (bb));
       df_simulate_initialize_backwards (bb, live);
-      bitmap_copy (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live);
+      peep2_reinit_state (live);
 
       for (insn = BB_END (bb); ; insn = prev)
 	{
@@ -3118,7 +3130,7 @@ peephole2_optimize (void)
 		  /* If an insn has RTX_FRAME_RELATED_P set, peephole
 		     substitution would lose the
 		     REG_FRAME_RELATED_EXPR that is attached.  */
-		  peep2_current_count = 0;
+		  peep2_reinit_state (live);
 		  attempt = NULL;
 		}
 	      else


	Jakub


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