OSDN Git Service

PR middle-end/40316
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Jun 2009 17:13:04 +0000 (17:13 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Jun 2009 17:13:04 +0000 (17:13 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148055 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/recog.c

index 3e745ea..70f131d 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2009-06-01  Steve Ellcey  <sje@cup.hp.com>
 
        * ia64.md (floatdirf2, fix_truncrfdi, floatunsdirf,
index 70b0967..4ee52af 100644 (file)
@@ -3056,6 +3056,26 @@ peep2_find_free_register (int from, int to, const char *class_str,
   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