https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70460
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, what about: --- gcc/ira.c.jj 2016-03-21 10:12:32.000000000 +0100 +++ gcc/ira.c 2016-03-30 18:42:46.095091159 +0200 @@ -3885,18 +3885,27 @@ indirect_jump_optimize (void) { rtx_insn *def_insn = DF_REF_INSN (def); rtx note = find_reg_note (def_insn, REG_LABEL_OPERAND, NULL_RTX); + rtx lab = NULL_RTX; 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; + rtx set = single_set (def_insn); + if (set + && GET_CODE (SET_SRC (set)) == LABEL_REF + && XEXP (SET_SRC (set), 0) == XEXP (note, 0)) + lab = SET_SRC (set); + else + { + rtx eqnote = find_reg_note (def_insn, REG_EQUAL, + NULL_RTX); + if (eqnote + && GET_CODE (XEXP (eqnote, 0)) == LABEL_REF + && XEXP (XEXP (eqnote, 0), 0) == XEXP (note, 0)) + lab = XEXP (eqnote, 0); + } } + if (lab && validate_replace_rtx (SET_SRC (x), lab, insn)) + rebuild_p = true; } } } then? Not trying to subst arbitrary rtxes into insn, just LABEL_REFs, both because it is unlikely to actually help and because one would need to verify it doesn't contain say REGs or MEMs clobbered in between def_insn and insn.