public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Biener <rguenther@suse.de>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: Re: [PATCH][PR67666] Handle single restrict pointer in struct in create_variable_info_for_1
Date: Tue, 29 Sep 2015 08:29:00 -0000	[thread overview]
Message-ID: <560A3383.3020608@mentor.com> (raw)
In-Reply-To: <alpine.LSU.2.11.1509220948590.24931@zhemvz.fhfr.qr>

On 22/09/15 09:49, Richard Biener wrote:
> On Tue, 22 Sep 2015, Tom de Vries wrote:
>
>> Hi,
>>
>> Consider this test-case:
>>
>> struct ps
>> {
>>    int *__restrict__ p;
>> };
>>
>> void
>> f (struct ps &__restrict__ ps1)
>> {
>>    *(ps1.p) = 1;
>> }
>>
>>
>> Atm, the restrict on p has no effect. Now, say we add a field to the struct:
>>
>> struct ps
>> {
>>    int *__restrict__ p;
>>    int a;
>> };
>>
>>
>> Then the restrict on p does have the desired effect.
>>
>>
>> This patch fixes the handling of structs with a single field in alias
>> analysis.
>>
>> Bootstrapped and reg-tested on x86_64.
>>
>> OK for trunk?
>
> Ok.
>

Hi,

I wonder if this follow-up patch is necessary.

Now that we handle structs with one field in the final loop of 
create_variable_info_for_1, should we set the is_full_var field as well? 
It used to be set for such structs before I committed the "Handle single 
restrict pointer in struct in create_variable_info_for_1" patch.

Thanks,
- Tom

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 8d86dcb..26d97a3 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5720,6 +5720,8 @@ create_variable_info_for_1 (tree decl, const char 
*name)
        newvi->offset = fo->offset;
        newvi->size = fo->size;
        newvi->fullsize = vi->fullsize;
+      if (fieldstack.length () == 1)
+       newvi->is_full_var = true;
        newvi->may_have_pointers = fo->may_have_pointers;
        newvi->only_restrict_pointers = fo->only_restrict_pointers;
        if (i + 1 < fieldstack.length ())

  reply	other threads:[~2015-09-29  6:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22  7:45 Tom de Vries
2015-09-22  8:13 ` Richard Biener
2015-09-29  8:29   ` Tom de Vries [this message]
2015-09-29  9:50     ` Richard Biener
2015-10-23  9:59       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560A3383.3020608@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).