This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: PATCH: PR rtl-optimization/45865: [4.6 Regression] ifcvt/crossjump failed to mark return jump


On Sat, Oct 23, 2010 at 7:17 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Thu, Oct 21, 2010 at 7:46 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sun, Oct 10, 2010 at 6:50 AM, Jason Merrill <jason@redhat.com> wrote:
>>>
>>> If the problem is that there's a return jump that isn't so marked, that
>>> seems to be the thing to fix, rather than assume that any jump within an
>>> epilogue is a return.
>>>
>>> Jason
>>>
>>
>> Does this patch make senses?
>
> I'd like to know where the unmarked jump is created, and mark it there.
>

The unmarked jump is created by force_nonfallthru_and_redirect:

  if (e->goto_locus && e->goto_block == NULL)
    loc = e->goto_locus;
  else
    loc = 0;
  e->flags &= ~EDGE_FALLTHRU;
  if (target == EXIT_BLOCK_PTR)
    {
#ifdef HAVE_return
        emit_jump_insn_after_setloc (gen_return (), BB_END (jump_block), loc);
#else
        gcc_unreachable ();
#endif
    }
  else
    {
      rtx label = block_label (target);
      emit_jump_insn_after_setloc (gen_jump (label), BB_END (jump_block), loc);
      JUMP_LABEL (BB_END (jump_block)) = label;
      LABEL_NUSES (label)++;
    }

My patch adds:

  /* If jump_block has an epilogue, mark the last insn as return jump
     if needed.  */
  FOR_BB_INSNS (jump_block, note)
    if (NOTE_P (note)
        && NOTE_KIND (note) == NOTE_INSN_EPILOGUE_BEG)
      {
        rtx jump = BB_END (jump_block);
        if (!returnjump_p (jump))
          {
            jump = pc_set (jump);
            SET_IS_RETURN_P (jump) = 1;
          }
        break;
      }

immediately after the jump is created.



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]