Commit 6585b2e2 by Alan Modra Committed by Alan Modra

Fix thinko in indirect_jump_optimize

	PR rtl-optimization/69195
	PR rtl-optimization/47992
	* ira.c (indirect_jump_optimize): Ignore artificial defs.
	Add comments.

From-SVN: r234235
parent 42c729c5
2016-03-16 Alan Modra <amodra@gmail.com>
PR rtl-optimization/69195
PR rtl-optimization/47992
* ira.c (indirect_jump_optimize): Ignore artificial defs.
Add comments.
2016-03-15 Eric Botcazou <ebotcazou@adacore.com> 2016-03-15 Eric Botcazou <ebotcazou@adacore.com>
PR bootstrap/69513 PR bootstrap/69513
......
...@@ -3842,7 +3842,8 @@ update_equiv_regs (void) ...@@ -3842,7 +3842,8 @@ update_equiv_regs (void)
free (pdx_subregs); free (pdx_subregs);
} }
/* A pass over indirect jumps, converting simple cases to direct jumps. */ /* A pass over indirect jumps, converting simple cases to direct jumps.
Combine does this optimization too, but only within a basic block. */
static void static void
indirect_jump_optimize (void) indirect_jump_optimize (void)
{ {
...@@ -3862,14 +3863,23 @@ indirect_jump_optimize (void) ...@@ -3862,14 +3863,23 @@ indirect_jump_optimize (void)
int regno = REGNO (SET_SRC (x)); int regno = REGNO (SET_SRC (x));
if (DF_REG_DEF_COUNT (regno) == 1) if (DF_REG_DEF_COUNT (regno) == 1)
{ {
rtx_insn *def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (regno)); df_ref def = DF_REG_DEF_CHAIN (regno);
rtx note = find_reg_note (def_insn, REG_LABEL_OPERAND, NULL_RTX); if (!DF_REF_IS_ARTIFICIAL (def))
if (note)
{ {
rtx lab = gen_rtx_LABEL_REF (Pmode, XEXP (note, 0)); rtx_insn *def_insn = DF_REF_INSN (def);
if (validate_replace_rtx (SET_SRC (x), lab, insn)) rtx note = find_reg_note (def_insn, REG_LABEL_OPERAND, NULL_RTX);
rebuild_p = true;
if (note)
{
/* Substitute a LABEL_REF to the label given by the
note rather than using SET_SRC of DEF_INSN.
DEF_INSN might be loading the label constant from
a constant pool, which isn't what we want in a
direct branch. */
rtx lab = gen_rtx_LABEL_REF (Pmode, XEXP (note, 0));
if (validate_replace_rtx (SET_SRC (x), lab, insn))
rebuild_p = true;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment