This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rtl]: Fix PR rtl-optimization/35604
- From: Ian Lance Taylor <iant at google dot com>
- To: "Uros Bizjak" <ubizjak at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Jun 2008 08:03:08 -0700
- Subject: Re: [PATCH, rtl]: Fix PR rtl-optimization/35604
- References: <5787cf470806180524j3af309b6m800b1fac791033c9@mail.gmail.com>
"Uros Bizjak" <ubizjak@gmail.com> writes:
> Index: jump.c
> ===================================================================
> --- jump.c (revision 136888)
> +++ jump.c (working copy)
> @@ -1290,7 +1290,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rt
> {
> rtx x = *loc;
> RTX_CODE code = GET_CODE (x);
> - int i;
> + int skip, i;
> const char *fmt;
>
> if (code == LABEL_REF)
> @@ -1327,8 +1327,13 @@ redirect_exp_1 (rtx *loc, rtx olabel, rt
> return;
> }
>
> + /* Skip the first operand of IF_THEN_ELSE insn. We should not
> + change OLABEL to NLABEL, if it is an operand to compare
> + against in the compare-and-branch instruction. */
> + skip = code == IF_THEN_ELSE;
> +
> fmt = GET_RTX_FORMAT (code);
> - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
> + for (i = GET_RTX_LENGTH (code) - 1; i >= skip; i--)
> {
> if (fmt[i] == 'e')
> redirect_exp_1 (&XEXP (x, i), olabel, nlabel, insn);
I would prefer to see this written in a slightly less tricky way,
something like:
if (code == IF_THEN_ELSE)
{
/* Skip the condition of an IF_THEN_ELSE. We only want to
change jump destinations, not label comparisons. */
redirect_exp_1 (&XEXP (x, 1), olabel, nlabel, insn);
redirect_exp_1 (&XEXP (x, 2), olabel, nlabel, insn);
return;
}
A patch along those lines is OK if it passes bootstrap and testing.
Thanks.
Ian