aboutsummaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-06-01 19:13:04 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-06-01 19:13:04 +0200
commit6c0d70212d6db24e0223638c5ab5256d7191659b (patch)
tree003d7a24dc5e92059fff7f41774048cf36d36700 /gcc/recog.c
parent49df2fb8bdbca6598a4ecee0da3fa7ab5ea6d41d (diff)
downloadgcc-6c0d70212d6db24e0223638c5ab5256d7191659b.zip
gcc-6c0d70212d6db24e0223638c5ab5256d7191659b.tar.gz
gcc-6c0d70212d6db24e0223638c5ab5256d7191659b.tar.bz2
re PR middle-end/40316 (Revision 147995 breaks gcc.target/i386/lea.c)
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. From-SVN: r148055
Diffstat (limited to 'gcc/recog.c')
-rw-r--r--gcc/recog.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/gcc/recog.c b/gcc/recog.c
index 70b0967..4ee52af 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -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