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: [PATCH] Fix cprop_jump conversion of a conditional jump into unconditional jump (PR rtl-optimization/33673)


Jakub Jelinek <jakub@redhat.com> writes:

> +  /* If a conditional jump has been changed into unconditional jump, remove
> +     the jump and make the edge fallthru - this is always called in
> +     cfglayout mode.  */
> +  if (new != pc_rtx && simplejump_p (jump))
> +    {
> +      edge e;
> +      edge_iterator ei;
> +
> +      for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
> +	if (e->dest != EXIT_BLOCK_PTR
> +	    && BB_HEAD (e->dest) == JUMP_LABEL (jump))
> +	  {
> +	    e->flags |= EDGE_FALLTHRU;
> +	    break;
> +	  }
> +      delete_insn (jump);
> +    }
> +

This loop doesn't make sense.  It never calls ei_next or anything else
to advance the edge_iterator.  It will presumably fail if the first
exit edge happens to be an exception edge.

The patch is OK with the obvious fix.

Ian


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