public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/24169]  New: Address (full struct) escapes even though the called function does not cause it to escape
@ 2005-10-02 20:32 pinskia at gcc dot gnu dot org
  2006-01-01  0:41 ` [Bug tree-optimization/24169] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-02 20:32 UTC (permalink / raw)
  To: gcc-bugs

Just like PR 23134, here is another testcase for the aliasing thinking that the
address escapes but this time it has SFT's involved and we should not have a
V_MAY_DEF for k.i:
static void f(char *a)
{
  *a = 1;
}

struct g
{
  char i, j;
};

void h(void)
{
  struct g k = {2, 2};
  f(&k.j);
  if (k.i != 2)
    link_error ();
}

Compile with -O2 -fno-inline to force f not to inline.


-- 
           Summary: Address (full struct) escapes even though the called
                    function does not cause it to escape
           Product: gcc
           Version: 4.1.0
            Status: NEW
          Keywords: missed-optimization, alias
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169


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

* [Bug tree-optimization/24169] Address (full struct) escapes even though the called function does not cause it to escape
  2005-10-02 20:32 [Bug tree-optimization/24169] New: Address (full struct) escapes even though the called function does not cause it to escape pinskia at gcc dot gnu dot org
@ 2006-01-01  0:41 ` pinskia at gcc dot gnu dot org
  2006-01-03 14:58   ` Daniel Berlin
  2006-01-03 14:58 ` dberlin at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-01  0:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-01 00:41 -------
Just a clarification here, I just want the SFT for k.j to be considered call
clobbered for this testcase.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169



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

* [Bug tree-optimization/24169] Address (full struct) escapes even though the called function does not cause it to escape
  2005-10-02 20:32 [Bug tree-optimization/24169] New: Address (full struct) escapes even though the called function does not cause it to escape pinskia at gcc dot gnu dot org
  2006-01-01  0:41 ` [Bug tree-optimization/24169] " pinskia at gcc dot gnu dot org
@ 2006-01-03 14:58 ` dberlin at dberlin dot org
  2010-07-15 22:50 ` steven at gcc dot gnu dot org
  2010-07-16  8:29 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: dberlin at dberlin dot org @ 2006-01-03 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dberlin at gcc dot gnu dot org  2006-01-03 14:58 -------
Subject: Re:  Address (full struct) escapes
        even though the called function does not cause it to escape

On Sun, 2006-01-01 at 00:41 +0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-01 00:41 -------
> Just a clarification here, I just want the SFT for k.j to be considered call
> clobbered for this testcase.
> 
This is not anywhere near as easy as you think it is.

In fact, we used to only call clobber k.j.  Because our standards
experts tell us that doing pointer arithmetic magic to get back to k.i
is legal, we could only consider this function to clobber *just* k.j if
the pointer doesn't escape from f, *and* f does not do any pointer
arithmetic on it's arguments.

This is usually *not* the case, making this testcase more or less "not
interesting at all".


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169



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

* Re: [Bug tree-optimization/24169] Address (full struct) escapes  even though the called function does not cause it to escape
  2006-01-01  0:41 ` [Bug tree-optimization/24169] " pinskia at gcc dot gnu dot org
@ 2006-01-03 14:58   ` Daniel Berlin
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Berlin @ 2006-01-03 14:58 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Sun, 2006-01-01 at 00:41 +0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-01 00:41 -------
> Just a clarification here, I just want the SFT for k.j to be considered call
> clobbered for this testcase.
> 
This is not anywhere near as easy as you think it is.

In fact, we used to only call clobber k.j.  Because our standards
experts tell us that doing pointer arithmetic magic to get back to k.i
is legal, we could only consider this function to clobber *just* k.j if
the pointer doesn't escape from f, *and* f does not do any pointer
arithmetic on it's arguments.

This is usually *not* the case, making this testcase more or less "not
interesting at all".




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

* [Bug tree-optimization/24169] Address (full struct) escapes even though the called function does not cause it to escape
  2005-10-02 20:32 [Bug tree-optimization/24169] New: Address (full struct) escapes even though the called function does not cause it to escape pinskia at gcc dot gnu dot org
  2006-01-01  0:41 ` [Bug tree-optimization/24169] " pinskia at gcc dot gnu dot org
  2006-01-03 14:58 ` dberlin at dberlin dot org
@ 2010-07-15 22:50 ` steven at gcc dot gnu dot org
  2010-07-16  8:29 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-07-15 22:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2010-07-15 22:50 -------
Would be quite useful, though, for languages that do not have/allow pointer
arithmetic.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2006-08-21 06:09:02         |2010-07-15 22:50:25
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169


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

* [Bug tree-optimization/24169] Address (full struct) escapes even though the called function does not cause it to escape
  2005-10-02 20:32 [Bug tree-optimization/24169] New: Address (full struct) escapes even though the called function does not cause it to escape pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-15 22:50 ` steven at gcc dot gnu dot org
@ 2010-07-16  8:29 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-16  8:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-07-16 08:29 -------
IPA-PTA computes the required information (but we do not store sub-field
granular points-to or clobber sets):

h.clobber = { k.8+8 }
h.use = { }
f.clobber = { k.8+8 } same as f.arg0
f.use = { }
f.arg0 = { k.8+8 }
k.0+8 = { }
k.8+8 = { }

<bb 2>:
  k.i = 2;
  k.j = 2;
  # CLB = { k }
  f (&k.j);
  D.2724_1 = k.i;
  if (D.2724_1 != 2)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  # USE = nonlocal
  # CLB = nonlocal
  link_error ();

<bb 4>:
  return;


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2010-07-15 22:50:25         |2010-07-16 08:29:05
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169


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

end of thread, other threads:[~2010-07-16  8:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-02 20:32 [Bug tree-optimization/24169] New: Address (full struct) escapes even though the called function does not cause it to escape pinskia at gcc dot gnu dot org
2006-01-01  0:41 ` [Bug tree-optimization/24169] " pinskia at gcc dot gnu dot org
2006-01-03 14:58   ` Daniel Berlin
2006-01-03 14:58 ` dberlin at dberlin dot org
2010-07-15 22:50 ` steven at gcc dot gnu dot org
2010-07-16  8:29 ` rguenth at gcc dot gnu dot org

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).