This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 37363: simplify_plus_minus creates invalid constants
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Tue, 11 Nov 2008 09:29:44 -0600
- Subject: Re: PR 37363: simplify_plus_minus creates invalid constants
- References: <87hc6fma9z.fsf@firetop.home>
On Mon, Nov 10, 2008 at 5:27 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> PR 37363 is about the way simplify_plus_minus can create a
> (const (minus ...)) expression in cases where such expressions
> are not allowed. This (const (minus ...)) code was originally
> added for PowerPC TOC references, but PowerPC now uses an
> UNSPEC-based representation instead.
>
> I think we've finally weaned all other targets off (const (minus ...))
> too, so there's no longer any need to create them in simplify_plus_minus.
>
> Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested
> by comparing the before and after assembly output for:
>
> gcc.c-torture gcc.dg g++.dg
>
> on these targets:
>
> powerpc-darwin powerpc64-darwin i386-darwin x86_64-darwin
> powerpc-linux-gnu powerpc64-linux-gnu powerpc-ibm-aix5.3.0
>
> using the options "-O2 -fpic". The output was the same.
> OK to install?
Ok.
Thanks,
Richard.
> Richard
>
>
> gcc/
> PR rtl-optimization/37363
> * simplify-rtx.c (simplify_plus_minus): Don't create (const (minus ...))
> expresisons.
>
> Index: gcc/simplify-rtx.c
> ===================================================================
> --- gcc/simplify-rtx.c 2008-10-08 05:15:29.000000000 +0100
> +++ gcc/simplify-rtx.c 2008-10-08 19:53:13.000000000 +0100
> @@ -3678,24 +3678,6 @@ simplify_plus_minus (enum rtx_code code,
> one CONST_INT, and the sort will have ensured that it is last
> in the array and that any other constant will be next-to-last. */
>
> - if (GET_CODE (ops[n_ops - 1].op) == CONST_INT)
> - i = n_ops - 2;
> - else
> - i = n_ops - 1;
> -
> - if (i >= 1
> - && ops[i].neg
> - && !ops[i - 1].neg
> - && CONSTANT_P (ops[i].op)
> - && GET_CODE (ops[i].op) == GET_CODE (ops[i - 1].op))
> - {
> - ops[i - 1].op = gen_rtx_MINUS (mode, ops[i - 1].op, ops[i].op);
> - ops[i - 1].op = gen_rtx_CONST (mode, ops[i - 1].op);
> - if (i < n_ops - 1)
> - ops[i] = ops[i + 1];
> - n_ops--;
> - }
> -
> if (n_ops > 1
> && GET_CODE (ops[n_ops - 1].op) == CONST_INT
> && CONSTANT_P (ops[n_ops - 2].op))
>