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
This commit is contained in:
Jakub Jelinek 2009-06-01 19:13:04 +02:00 committed by Jakub Jelinek
parent 49df2fb8bd
commit 6c0d70212d
2 changed files with 29 additions and 10 deletions

View 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,

View 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