public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores
@ 2004-08-17 14:05 pbrook at gcc dot gnu dot org
  2004-08-17 14:12 ` [Bug tree-optimization/17064] " dnovillo at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2004-08-17 14:05 UTC (permalink / raw)
  To: gcc-bugs

When the following example is compiled with -fargument-noalias-global, the 
store *p=1 is dead and should be removed. 
-fargument-noalias-global is the default for Fortran. 
 
#include <stdlib.h> 
int i; 
int j; 
 
void bar(void) 
{ 
  i = 42; 
} 
 
void foo(int * p) 
{ 
  *p = 1;/* This store is dead with -fargument-noalias-global.  */ 
  bar (); 
  *p = 2; 
} 
 
int main() 
{ 
  i = 0; 
  j = 0; 
  foo(&j); 
  if (i != 42 || j != 2) 
    abort(); 
  return 0; 
}

-- 
           Summary: -falias-noargument-global doesn't eliminate dead stores
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pbrook at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
@ 2004-08-17 14:12 ` dnovillo at gcc dot gnu dot org
  2004-11-06 20:14 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2004-08-17 14:12 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dnovillo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
  2004-08-17 14:12 ` [Bug tree-optimization/17064] " dnovillo at gcc dot gnu dot org
@ 2004-11-06 20:14 ` pinskia at gcc dot gnu dot org
  2005-02-08  0:01 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-06 20:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-06 20:14 -------
Even for the simple testcase, we don't eliminate dead stores:
int i;
int j;
int main()
{
  i = 0; <<--should be removed
  j = 0; <<--should be removed
  j = 1; <<--should be removed
  i = 42;
  j = 2;
}

-- 


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
  2004-08-17 14:12 ` [Bug tree-optimization/17064] " dnovillo at gcc dot gnu dot org
  2004-11-06 20:14 ` pinskia at gcc dot gnu dot org
@ 2005-02-08  0:01 ` pinskia at gcc dot gnu dot org
  2005-02-08  0:29 ` [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-08  0:01 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |alias
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-07 18:53:37
               date|                            |


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-02-08  0:01 ` pinskia at gcc dot gnu dot org
@ 2005-02-08  0:29 ` pinskia at gcc dot gnu dot org
  2005-03-04  3:42 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-08  0:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-07 19:00 -------
Another testcase this time for loads:
#include <stdlib.h>
int i;

void bar(void)
{
  i = 42;
}

int foo(int * p)
{
  int i = *p;
  bar ();
  return *p + i;/* This load is dead with -fargument-noalias-global.  */
}

int main()
{
  int t = 2;
  int t1;
  t1 = foo(&t);
  if (t1 != 4)
    abort();
  return 0;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-falias-noargument-global   |-falias-noargument-global
                   |doesn't eliminate dead      |doesn't eliminate dead
                   |stores                      |stores/loads


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-02-08  0:29 ` [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads pinskia at gcc dot gnu dot org
@ 2005-03-04  3:42 ` pinskia at gcc dot gnu dot org
  2005-07-27 17:13 ` pinskia at gcc dot gnu dot org
  2005-08-06 19:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-04  3:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-04 03:41 -------
Here is a testcase which we semi optimize on the RTL level but not at the tree level:
sum cannot alias a or b at all because of the default option for gfortran.

subroutine dot_product (sum, a, b, n)
   real*8 a(n), b(n), sum
   sum = 0
   do i = 1, n
     sum = sum + a (i) * b(i)
   end do
end

The reason why I say semi is because there is an extra fmr (PPC):
The loop looks like:
L4:
        lfd f13,0(r4)
        addi r4,r4,8
        lfd f0,0(r5)
        addi r5,r5,8
        fmadd f0,f13,f0,f12
        fmr f12,f0
        bdnz L4

If we had optimizate it at the tree level it would look like:
L4:
        lfd f13,0(r4)
        addi r4,r4,8
        lfd f0,0(r5)
        addi r5,r5,8
        fmadd f12,f13,f0,f12
        bdnz L4

Note how we don't have the extra fmr.

-- 


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-03-04  3:42 ` pinskia at gcc dot gnu dot org
@ 2005-07-27 17:13 ` pinskia at gcc dot gnu dot org
  2005-08-06 19:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-27 17:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-27 17:06 -------
Another testcase for extra load at the tree level:
int g (int* g1, int* g2)
{
  int i;
  g2[0] = 2;
  g1[0] = 3;
  return g2[0];
}

Note the test in comment #1 has been fixed already.

-- 


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


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

* [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads
  2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-07-27 17:13 ` pinskia at gcc dot gnu dot org
@ 2005-08-06 19:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-06 19:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-06 19:51 -------
Diego, sorry to steal this from you but I got a fix for this issue though there are still some issues with 
address considered call clobered which cannot be true.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dnovillo at gcc dot gnu dot |pinskia at gcc dot gnu dot
                   |org                         |org


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


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

end of thread, other threads:[~2005-08-06 19:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-17 14:05 [Bug tree-optimization/17064] New: -falias-noargument-global doesn't eliminate dead stores pbrook at gcc dot gnu dot org
2004-08-17 14:12 ` [Bug tree-optimization/17064] " dnovillo at gcc dot gnu dot org
2004-11-06 20:14 ` pinskia at gcc dot gnu dot org
2005-02-08  0:01 ` pinskia at gcc dot gnu dot org
2005-02-08  0:29 ` [Bug tree-optimization/17064] -falias-noargument-global doesn't eliminate dead stores/loads pinskia at gcc dot gnu dot org
2005-03-04  3:42 ` pinskia at gcc dot gnu dot org
2005-07-27 17:13 ` pinskia at gcc dot gnu dot org
2005-08-06 19:51 ` 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).