This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix cprop_jump conversion of a conditional jump into unconditional jump (PR rtl-optimization/33673)
- From: Ian Lance Taylor <iant at google dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 31 Oct 2007 17:59:13 -0700
- Subject: Re: [PATCH] Fix cprop_jump conversion of a conditional jump into unconditional jump (PR rtl-optimization/33673)
- References: <20071030221224.GR5451@devserv.devel.redhat.com>
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