[PATCH] Fix DCE REG_LIBCALL note moving from noop move insns (PR rtl-optimization/33644)
Eric Botcazou
ebotcazou@libertysurf.fr
Mon Oct 15 14:48:00 GMT 2007
> Rewriting DCE to deal with libcalls like "every other pass" will add
> several O(n) walks in bad places.
Well, DCE already does O(n) walks everytime it deals with an instruction that
belongs to a libcall:
/* Mark all insns using DELETE_PARM in the libcall that contains
START_INSN. */
static void
mark_libcall (rtx start_insn, bool delete_parm)
{
rtx note = find_reg_note (start_insn, REG_LIBCALL_ID, NULL_RTX);
int id = INTVAL (XEXP (note, 0));
rtx insn;
mark_insn (start_insn, delete_parm);
insn = NEXT_INSN (start_insn);
/* There are tales, long ago and far away, of the mystical nested
libcall. No one alive has actually seen one, but other parts of
the compiler support them so we will here. */
for (insn = NEXT_INSN (start_insn); insn; insn = NEXT_INSN (insn))
{
if (INSN_P (insn))
{
/* Stay in the loop as long as we are in any libcall. */
if ((note = find_reg_note (insn, REG_LIBCALL_ID, NULL_RTX)))
{
if (id == INTVAL (XEXP (note, 0)))
{
mark_insn (insn, delete_parm);
if (dump_file)
fprintf (dump_file, "matching forward libcall %d[%d]\n",
INSN_UID (insn), id);
}
}
else
break;
}
}
for (insn = PREV_INSN (start_insn); insn; insn = PREV_INSN (insn))
{
if (INSN_P (insn))
{
/* Stay in the loop as long as we are in any libcall. */
if ((note = find_reg_note (insn, REG_LIBCALL_ID, NULL_RTX)))
{
if (id == INTVAL (XEXP (note, 0)))
{
mark_insn (insn, delete_parm);
if (dump_file)
fprintf (dump_file, "matching backward libcall %d[%d]\n",
INSN_UID (insn), id);
}
}
else
break;
}
}
}
So AFAICS the only purpose of REG_LIBCALL_ID is to answer the question "is
this insn part of a libcall?", what a mere bitmap populated during the
initial pass over the instructions would do.
--
Eric Botcazou
More information about the Gcc-patches
mailing list