This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch][google/gcc-4_8] Backport r198101 (fix for PR56847) into google/gcc-4_8
- From: Dehao Chen <dehao at google dot com>
- To: Han Shen(ææ) <shenhan at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 24 Apr 2013 20:16:02 -0700
- Subject: Re: [Patch][google/gcc-4_8] Backport r198101 (fix for PR56847) into google/gcc-4_8
- References: <CACkGtria_a6h0GWF9h60HxpE3WnAUzVB2mtSZKqW36L7xGEhwA at mail dot gmail dot com>
Looks good.
Dehao
On Wed, Apr 24, 2013 at 5:49 PM, Han Shen(ææ) <shenhan@google.com> wrote:
> Hi, this patch back port trunk@198101 to fix PR rtl-optimization/56847.
>
> Passed bootstrap and regression test.
>
> Ok for branch google/gcc-4_8?
>
> 2013-04-19 Vladimir Makarov <vmakarov@redhat.com>
>
> PR rtl-optimization/56847
> * lra-constraints.c (process_alt_operands): Discourage alternative
> with non-matche doffsettable memory constraint fro memory with
> known offset.
>
> diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
> index e3b4add..9e4924c 100644
> --- a/gcc/lra-constraints.c
> +++ b/gcc/lra-constraints.c
> @@ -1978,8 +1978,15 @@ process_alt_operands (int only_alternative)
> (op, this_alternative) == NO_REGS))))
> reject += LRA_MAX_REJECT;
>
> - if (! ((const_to_mem && constmemok)
> - || (MEM_P (op) && offmemok)))
> + if (MEM_P (op) && offmemok)
> + {
> + /* If we know offset and this non-offsetable memory,
> + something wrong with this memory and it is better
> + to try other memory possibilities. */
> + if (MEM_OFFSET_KNOWN_P (op))
> + reject += LRA_MAX_REJECT;
> + }
> + else if (! (const_to_mem && constmemok))
> {
> /* We prefer to reload pseudos over reloading other
> things, since such reloads may be able to be
> diff --git a/gcc/testsuite/gcc.dg/pr56847.c b/gcc/testsuite/gcc.dg/pr56847.c
> new file mode 100644
> index 0000000..b94aae1
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr56847.c
> @@ -0,0 +1,12 @@
> +/* PR rtl-optimization/56847 */
> +/* { dg-do compile { target pie } } */
> +/* { dg-options "-O2 -fpie" } */
> +
> +struct S { long int a, b; } e;
> +__thread struct S s;
> +
> +void
> +foo (void)
> +{
> + s = e;
> +}
>
>
> H.