public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierrick Philippe <pierrick.philippe@irisa.fr>
To: gcc@gcc.gnu.org
Subject: [Tree-SSA] Question from observation, bogus SSA form?
Date: Thu, 16 Mar 2023 16:26:48 +0100	[thread overview]
Message-ID: <d89b8539-d41f-18fc-1f36-83bcaab772e8@irisa.fr> (raw)

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

Hi everyone,

I was working around with the analyzer, but I usually dump the SSA-tree 
to get a view of the analyzed code.
This is how I noticed something wrong, at least in the sense of the 
definition of SSA form.

I'm using a version of gcc build from a /trunk/ branch (/20230309/).

Here is an example code:

'''
int main(void) {
     int x = 42;
     int * y = &x;
     x = 6;
     return x;
}
'''

And here is the output from -fdump-tree-ssa-vops:

'''
;; Function main (main, funcdef_no=0, decl_uid=2739, cgraph_uid=1, 
symbol_order=0)

int main ()
{
   int * y;
   int x;
   int D.2744;
   int _5;

   <bb 2> :
   # .MEM_2 = VDEF <.MEM_1(D)>
   x = 42;                                           // First assignment 
to var_decl x
   y_3 = &x;
   # .MEM_4 = VDEF <.MEM_2>
   x = 6;                                             // Second 
assignment to var_decl x
   # VUSE <.MEM_4>
   _5 = x;
   # .MEM_6 = VDEF <.MEM_4>
   x ={v} {CLOBBER(eol)};

   <bb 3> :
<L1>:
   # VUSE <.MEM_6>
   return _5;

}
'''

The thing is, there is two distinct assignment to the same LHS tree at 
two different gimple statement, which is by definition not supposed to 
happened in SSA form.
Is there any particular reason this happen? Is that because the address 
of x is taken and stored?

I have to precise, I did not dig into the SSA form transformation and am 
a newbie to gcc source code.
So maybe my question is a bit naive or a known issue.

Thank you for your time,

Pierrick

             reply	other threads:[~2023-03-16 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 15:26 Pierrick Philippe [this message]
2023-03-16 16:30 ` Martin Jambor
2023-03-17 13:55   ` Pierrick Philippe
2023-03-17 14:34     ` Michael Matz

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=d89b8539-d41f-18fc-1f36-83bcaab772e8@irisa.fr \
    --to=pierrick.philippe@irisa.fr \
    --cc=gcc@gcc.gnu.org \
    /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).