This is the mail archive of the
mailing list for the GCC project.
Re: [4.2 only] RFA: PR 33848: reload rematerialisation of labels
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Richard Sandiford <rsandifo at nildram dot co dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Oct 2007 22:30:47 +0200
- Subject: Re: [4.2 only] RFA: PR 33848: reload rematerialisation of labels
- References: <email@example.com>
> PR 33848, a 4.2 regression on MIPS, is about cases in which we have
> a branch like:
> if (foo == &&bar)
> and in which the register that holds &&bar is not allocated a hard
> register. Reload rematerialises the load of &&bar, first replacing the
> pseudo register with the label, then replacing the label with a reload
> register. The second step triggers the following code in
> /* If we're replacing a LABEL_REF with a register, add a
> REG_LABEL note to indicate to flow which label this
> register refers to. */
> if (GET_CODE (*r->where) == LABEL_REF
> && JUMP_P (insn))
> REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL,
> XEXP (*r->where, 0),
> REG_NOTES (insn));
> JUMP_LABEL (insn) = XEXP (*r->where, 0);
> So we end up replacing the jump's real JUMP_LABEL with bar, and
> cfgcleanup later deletes the real target as dead.
Yes, this is relatively recent, the original code didn't modify JUMP_LABEL.
> H-P fixed this properly on mainline by splitting REG_LABEL into
> REG_LABEL_OPERAND and REG_LABEL_TARGET. Unfortunately, I think that's
> too invasive to backport.
Agreed. Moreover H-P's patch still has unresolved issues.
> And since JUMP_LABEL should now always be valid before reload, I think we
> should only add a REG_LABEL note when the label is the same as the current
> JUMP_LABEL. Calling rebuild_jump_labels immediately after reload
> would then be a no-op for this particular insn, just as it should be.
Can't we nevertheless imagine a JUMP_P insn reaching here without JUMP_LABEL?
> If so, should I install the testcase on mainline too?
I think that the testsuite should increase monotically.