This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c/8439
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 8 Nov 2002 13:30:05 +0100
- Subject: Re: [PATCH] PR c/8439
- References: <15760000.1036643132@localhost>
> The real problem is that validate_replace_rtx_1 is performing
> simplifications; when we replace the virtual argument pointer with
> the real one it tries to get rid of the plus in the following:
>
> (set (mem/f:SI (reg/f:SI 53 virtual-incoming-args) [0 p+0 S4 A32])
> (plus:SI (mem/f:SI (reg/f:SI 53 virtual-incoming-args) [0 p+0 S4 A32])
> (const_int 0 [0x0])))
>
> which makes the expression unrecognizable.
Yes, the (const_int 0) is thrown away. This seems to be really problematic
(see PR c/7411).
> There's even a comment:
>
> /* If we have a PLUS whose second operand is now a CONST_INT, use
> plus_constant to try to simplify it.
> ??? We may want later to remove this, once simplification is
> separated from this function. */
>
> We should really be simplifying only if *both* arguments are now
> CONST_INTs. I'll try that for mainline.
Perhaps we should be simplifying only if there is something new to be
simplified ? This approach had been used until Jan's patch:
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00780.html
After reading the message, I don't know whether the patch is a fix or not.
Anyway, reverting it fixes the problem.
--- gcc/recog.c.orig Fri Nov 8 12:41:35 2002
+++ gcc/recog.c Fri Nov 8 13:13:22 2002
@@ -522,10 +522,10 @@
{
case PLUS:
/* If we have a PLUS whose second operand is now a CONST_INT, use
- plus_constant to try to simplify it.
+ simplify_gen_binary to try to simplify it.
??? We may want later to remove this, once simplification is
separated from this function. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
+ if (GET_CODE (XEXP (x, 1)) == CONST_INT && XEXP (x, 1) == to)
validate_change (object, loc,
simplify_gen_binary
(PLUS, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)), 1);
I can bootstrap/regtest it if you think this approach is correct (even on the
branch).
--
Eric Botcazou