public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
@ 2008-03-14 20:07 ` rguenth at gcc dot gnu dot org
  2008-04-07  1:33 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-14 20:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-03-14 20:06 -------
This is related to PR27799.  It is also fixed with -fstrict-aliasing on the
tree level:

bar ()
{
  struct example * ex1.0;

<bb 2>:
  ex1.0 = ex1;
  ex1.0->a = 1;
  ex1.0->b = 2;
  ex1.0->c = 3;
  return;

}

Without -fstrict-aliasing we get (see PR27799):

bar ()
{
  struct example * ex1.0;

<bb 2>:
  # VUSE <ex1_4(D)>
  ex1.0_1 = ex1;
  # ex1_6 = VDEF <ex1_4(D)>
  # SMT.5_7 = VDEF <SMT.5_5(D)>
  ex1.0_1->a = 1;
  # VUSE <ex1_6>
  ex1.0_2 = ex1;
  # ex1_8 = VDEF <ex1_6>
  # SMT.5_9 = VDEF <SMT.5_7>
  ex1.0_2->b = 2;
  # VUSE <ex1_8>
  ex1.0_3 = ex1;
  # ex1_10 = VDEF <ex1_8>
  # SMT.5_11 = VDEF <SMT.5_9>
  ex1.0_3->c = 3;
  return;

while with -fstrict-aliasing we have

bar ()
{
  struct example * ex1.0;

<bb 2>:
  # VUSE <ex1_4(D)>
  ex1.0_1 = ex1;
  # SMT.5_6 = VDEF <SMT.5_5(D)>
  ex1.0_1->a = 1;
  # VUSE <ex1_4(D)>
  ex1.0_2 = ex1;
  # SMT.5_7 = VDEF <SMT.5_6>
  ex1.0_2->b = 2;
  # VUSE <ex1_4(D)>
  ex1.0_3 = ex1;
  # SMT.5_8 = VDEF <SMT.5_7>
  ex1.0_3->c = 3;
  return;

}

If you disable all tree optimizations that do the optimization you still
have the missed optimization on the RTL level and get

bar:
        pushl   %ebp
        movl    %esp, %ebp
        movl    ex1, %eax
        movb    $1, (%eax)
        movl    ex1, %eax
        movl    $2, 4(%eax)
        movb    $3, 8(%eax)
        popl    %ebp
        ret

without strict-aliasing it gets even

bar:
        pushl   %ebp
        movl    %esp, %ebp
        movl    ex1, %eax
        movb    $1, (%eax)
        movl    ex1, %eax
        movl    $2, 4(%eax)
        movl    ex1, %eax
        movb    $3, 8(%eax)
        popl    %ebp
        ret


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
OtherBugsDependingO|                            |27799
              nThis|                            |
   Last reconfirmed|2006-02-16 21:27:01         |2008-03-14 20:06:36
               date|                            |


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
  2008-03-14 20:07 ` [Bug tree-optimization/2480] aliasing problem with global structures rguenth at gcc dot gnu dot org
@ 2008-04-07  1:33 ` pinskia at gcc dot gnu dot org
  2008-04-07  9:01 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-07  1:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2008-04-07 01:32 -------
Hmm, we do get something different on the trunk:
bar ()
{
  struct example * ex1.0;

<bb 2>:
  ex1.0 = ex1;
  ex1.0->a = 1;
  ex1.0->b = 2;
  ex1.0->c = 3;
  if (ex1.0->b != 2)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  link_error ();
  if (ex1->c != 3)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
Invalid sum of incoming frequencies 5123, should be 6216
  link_error () [tail call];

<bb 5>:
Invalid sum of incoming frequencies 11093, should be 10000
  return;

}


-- 


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
  2008-03-14 20:07 ` [Bug tree-optimization/2480] aliasing problem with global structures rguenth at gcc dot gnu dot org
  2008-04-07  1:33 ` pinskia at gcc dot gnu dot org
@ 2008-04-07  9:01 ` rguenth at gcc dot gnu dot org
  2009-04-03 11:27 ` rguenth at gcc dot gnu dot org
  2009-04-03 12:38 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-07  9:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenth at gcc dot gnu dot org  2008-04-07 09:00 -------
This is because the oracle is confused by the link_error () call which clobbers
*ex2 and *ex1.  Note that SCCVN does not consider control-dependence as it
considers all edges executable all the time.


-- 


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-04-07  9:01 ` rguenth at gcc dot gnu dot org
@ 2009-04-03 11:27 ` rguenth at gcc dot gnu dot org
  2009-04-03 12:38 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-03 11:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from rguenth at gcc dot gnu dot org  2009-04-03 11:27 -------
Fixed at -O2 since 4.4.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2009-04-03 11:27 ` rguenth at gcc dot gnu dot org
@ 2009-04-03 12:38 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-03 12:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from rguenth at gcc dot gnu dot org  2009-04-03 12:38 -------
Subject: Bug 2480

Author: rguenth
Date: Fri Apr  3 12:38:08 2009
New Revision: 145499

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145499
Log:
2009-04-03  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/2480
        PR tree-optimization/23086
        * gcc.dg/tree-ssa/pr2480.c: New testcase.
        * gcc.dg/tree-ssa/pr23086.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
                   ` (4 preceding siblings ...)
  2005-01-31  6:57 ` pinskia at gcc dot gnu dot org
@ 2005-06-09 16:45 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-09 16:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-09 16:45 -------
Part of this has been fixed, there is only one loading of ex1 now on the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-05-02 00:52:06         |2005-06-09 16:45:02
               date|                            |


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
                   ` (3 preceding siblings ...)
  2005-01-23 15:42 ` pinskia at gcc dot gnu dot org
@ 2005-01-31  6:57 ` pinskia at gcc dot gnu dot org
  2005-06-09 16:45 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-31  6:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.0                       |---


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
                   ` (2 preceding siblings ...)
  2005-01-23 15:23 ` steven at gcc dot gnu dot org
@ 2005-01-23 15:42 ` pinskia at gcc dot gnu dot org
  2005-01-31  6:57 ` pinskia at gcc dot gnu dot org
  2005-06-09 16:45 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-23 15:42 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
  2005-01-23 14:55 ` steven at gcc dot gnu dot org
  2005-01-23 15:15 ` pinskia at gcc dot gnu dot org
@ 2005-01-23 15:23 ` steven at gcc dot gnu dot org
  2005-01-23 15:42 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 15:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 15:23 -------
Whoops.  I forgot to link.  
 

-- 


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
  2005-01-23 14:55 ` steven at gcc dot gnu dot org
@ 2005-01-23 15:15 ` pinskia at gcc dot gnu dot org
  2005-01-23 15:23 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-23 15:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-23 15:15 -------
This is not fixed, see example #2.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


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

* [Bug tree-optimization/2480] aliasing problem with global structures
       [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
@ 2005-01-23 14:55 ` steven at gcc dot gnu dot org
  2005-01-23 15:15 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 14:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 14:54 -------
CVS today: 
 
        .text 
        .p2align 4,,15 
.globl bar 
        .type   bar, @function 
bar: 
        movl    ex1, %eax 
        pushl   %ebp 
        movl    %esp, %ebp 
        movb    $1, (%eax) 
        movl    $2, 4(%eax) 
        movb    $3, 8(%eax) 
        leave 
        ret 
        .size   bar, .-bar 
        .p2align 4,,15 
.globl foo 
        .type   foo, @function 
foo: 
        pushl   %ebp 
        movl    %esp, %ebp 
        movl    8(%ebp), %eax 
        movb    $1, (%eax) 
        movl    $2, 4(%eax) 
        movb    $3, 8(%eax) 
        leave 
        ret 
        .size   foo, .-foo 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2009-04-03 12:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-2480-1008@http.gcc.gnu.org/bugzilla/>
2008-03-14 20:07 ` [Bug tree-optimization/2480] aliasing problem with global structures rguenth at gcc dot gnu dot org
2008-04-07  1:33 ` pinskia at gcc dot gnu dot org
2008-04-07  9:01 ` rguenth at gcc dot gnu dot org
2009-04-03 11:27 ` rguenth at gcc dot gnu dot org
2009-04-03 12:38 ` rguenth at gcc dot gnu dot org
     [not found] <20010403165559.2480.dann@godzilla.ics.uci.edu>
2005-01-23 14:55 ` steven at gcc dot gnu dot org
2005-01-23 15:15 ` pinskia at gcc dot gnu dot org
2005-01-23 15:23 ` steven at gcc dot gnu dot org
2005-01-23 15:42 ` pinskia at gcc dot gnu dot org
2005-01-31  6:57 ` pinskia at gcc dot gnu dot org
2005-06-09 16:45 ` pinskia 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).