> Jan Hubicka <[EMAIL PROTECTED]> writes:
>
> > > Jan Hubicka <[EMAIL PROTECTED]> writes:
> > >
> > > > Producing USE expressions embedding whole INSN. The comment promise
> > > > that those will be removed before reorg ends, but they are not. This
> > > > patch just adds simple code to remove them in very last dbr_schedule
> > > > pass.
> > >
> > > I see code in dbr_schedule to delete them:
> > >
> > > /* Delete any USE insns made by update_block; subsequent passes don't
> > > need
> > > them or know how to deal with them. */
> > > for (insn = first; insn; insn = next)
> > > {
> > > next = NEXT_INSN (insn);
> > >
> > > if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
> > > && INSN_P (XEXP (PATTERN (insn), 0)))
> > > next = delete_related_insns (insn);
> > > }
> > >
> > > Why is that not working?
> >
> > Hmm, good catch. I didn't noticed that code.
> > The problem is that update_block is still called after this loop is
> > done, at least moving that loop down past the loop just bellow it solves
> > the ICE too.
>
> Ah, it's from the calls to fill_simple_delay_slots in
> make_return_insns. The "Delete any USE insns" loop needs to move
> below that.
>
> > I must admit I have no idea what those placeholders are good for...
>
> They tell mark_target_live_regs that the registers used by the insn
> which was moved are live.
Ah, I see.
The attached patch seems to work on my testcase too.
Honza
Index: reorg.c
===================================================================
--- reorg.c (revision 128145)
+++ reorg.c (working copy)
@@ -3863,17 +3863,6 @@ dbr_schedule (rtx first)
relax_delay_slots (first);
}
- /* Delete any USE insns made by update_block; subsequent passes don't need
- them or know how to deal with them. */
- for (insn = first; insn; insn = next)
- {
- next = NEXT_INSN (insn);
-
- if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
- && INSN_P (XEXP (PATTERN (insn), 0)))
- next = delete_related_insns (insn);
- }
-
/* If we made an end of function label, indicate that it is now
safe to delete it by undoing our prior adjustment to LABEL_NUSES.
If it is now unused, delete it. */
@@ -3885,6 +3874,17 @@ dbr_schedule (rtx first)
make_return_insns (first);
#endif
+ /* Delete any USE insns made by update_block; subsequent passes don't need
+ them or know how to deal with them. */
+ for (insn = first; insn; insn = next)
+ {
+ next = NEXT_INSN (insn);
+
+ if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
+ && INSN_P (XEXP (PATTERN (insn), 0)))
+ next = delete_related_insns (insn);
+ }
+
obstack_free (&unfilled_slots_obstack, unfilled_firstobj);
/* It is not clear why the line below is needed, but it does seem to be. */