public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* ptx preliminary address space fixes [2/4]
@ 2014-09-11 10:13 Bernd Schmidt
  2014-09-11 11:30 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Schmidt @ 2014-09-11 10:13 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

This is a bug in SRA which replaces a memory reference without taking 
care to use the correct address space.

Bootstrapped and tested together with the other patches on x86_64-linux. 
  Ok?


Bernd

[-- Attachment #2: ptx-as2.diff --]
[-- Type: text/x-patch, Size: 778 bytes --]

commit 6b9be6e3081c313c024aeabe2d70bc0f8146b429
Author: Bernd Schmidt <bernds@codesourcery.com>
Date:   Wed Sep 10 16:32:56 2014 +0200

    	* tree-sra.c (build_ref_for_offset): Use existing address space
    	when replacing a memory reference.

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 8259dba..c69cc90 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1561,6 +1561,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
   if (align < TYPE_ALIGN (exp_type))
     exp_type = build_aligned_type (exp_type, align);
 
+  exp_type = apply_as_to_type (exp_type, TYPE_ADDR_SPACE (TREE_TYPE (prev_base)));
   mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off);
   if (TREE_THIS_VOLATILE (prev_base))
     TREE_THIS_VOLATILE (mem_ref) = 1;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ptx preliminary address space fixes [2/4]
  2014-09-11 10:13 ptx preliminary address space fixes [2/4] Bernd Schmidt
@ 2014-09-11 11:30 ` Richard Biener
  2014-09-12 11:18   ` Bernd Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2014-09-11 11:30 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On Thu, Sep 11, 2014 at 12:12 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> This is a bug in SRA which replaces a memory reference without taking care
> to use the correct address space.
>
> Bootstrapped and tested together with the other patches on x86_64-linux.
> Ok?

Ok (with adjustments necessary for renaming apply_as_to_type).

Thanks,
Richard.

>
> Bernd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ptx preliminary address space fixes [2/4]
  2014-09-11 11:30 ` Richard Biener
@ 2014-09-12 11:18   ` Bernd Schmidt
  2014-09-12 11:50     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Schmidt @ 2014-09-12 11:18 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 09/11/2014 01:30 PM, Richard Biener wrote:
> On Thu, Sep 11, 2014 at 12:12 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
>> This is a bug in SRA which replaces a memory reference without taking care
>> to use the correct address space.
>>
>> Bootstrapped and tested together with the other patches on x86_64-linux.
>> Ok?
>
> Ok (with adjustments necessary for renaming apply_as_to_type).

How about this variant with a suitable reference_apply_addr_space?

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c.orig
+++ gcc/tree-sra.c
@@ -1562,6 +1562,8 @@ build_ref_for_offset (location_t loc, tr
      exp_type = build_aligned_type (exp_type, align);

    mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off);
+  reference_apply_addr_space (mem_ref,
+			      TYPE_ADDR_SPACE (TREE_TYPE (prev_base));
    if (TREE_THIS_VOLATILE (prev_base))
      TREE_THIS_VOLATILE (mem_ref) = 1;
    if (TREE_SIDE_EFFECTS (prev_base))


Bernd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ptx preliminary address space fixes [2/4]
  2014-09-12 11:18   ` Bernd Schmidt
@ 2014-09-12 11:50     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2014-09-12 11:50 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On Fri, Sep 12, 2014 at 1:17 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 09/11/2014 01:30 PM, Richard Biener wrote:
>>
>> On Thu, Sep 11, 2014 at 12:12 PM, Bernd Schmidt <bernds@codesourcery.com>
>> wrote:
>>>
>>> This is a bug in SRA which replaces a memory reference without taking
>>> care
>>> to use the correct address space.
>>>
>>> Bootstrapped and tested together with the other patches on x86_64-linux.
>>> Ok?
>>
>>
>> Ok (with adjustments necessary for renaming apply_as_to_type).
>
>
> How about this variant with a suitable reference_apply_addr_space?
>
> Index: gcc/tree-sra.c
> ===================================================================
> --- gcc/tree-sra.c.orig
> +++ gcc/tree-sra.c
> @@ -1562,6 +1562,8 @@ build_ref_for_offset (location_t loc, tr
>      exp_type = build_aligned_type (exp_type, align);
>
>    mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off);
> +  reference_apply_addr_space (mem_ref,
> +                             TYPE_ADDR_SPACE (TREE_TYPE (prev_base));
>    if (TREE_THIS_VOLATILE (prev_base))
>      TREE_THIS_VOLATILE (mem_ref) = 1;
>    if (TREE_SIDE_EFFECTS (prev_base))

Ok with using reference_addr_space (prev_base).

Thanks,
Richard.

>
> Bernd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-12 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 10:13 ptx preliminary address space fixes [2/4] Bernd Schmidt
2014-09-11 11:30 ` Richard Biener
2014-09-12 11:18   ` Bernd Schmidt
2014-09-12 11:50     ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).