public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/34677]  New: PREs insert_fake_stores is mostly useless
@ 2008-01-04 17:01 rguenth at gcc dot gnu dot org
  2008-01-04 17:03 ` [Bug tree-optimization/34677] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 17:01 UTC (permalink / raw)
  To: gcc-bugs

Because it only handles stores through direct INDIRECT_REFs.  So while we
handle
testcases like loadpre4.c:

int main(int *a, int argc)
{
  int b;
  int c;
  int i;
  int d, e;

  for (i = 0; i < argc; i++)
    {
      e = *a;
      *a = 9;
    }
  return d + e;
}

the much simpler

int a;

int foo(int argc)
{
  int b;
  int c;
  int i;
  int d, e;

  for (i = 0; i < argc; i++)
    {
      e = a;
      a = 9;
    }
  return d + e;
}

or the only slightly more complex

struct {
  int a;
  int large[100];
} x;

int foo(int argc)
{
  int b;
  int c;
  int i;
  int d, e;

  for (i = 0; i < argc; i++)
    {
      e = x.a;
      x.a = 9;
    }
  return d + e;
}

is not handled.  If you disable insertion of fake stores completely, only
two loadpre tests fail in tree-ssa.exp.  Did the new SCCVN obsolete some
cases where we needed the fake stores before but do not so now?


-- 
           Summary: PREs insert_fake_stores is mostly useless
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
@ 2008-01-04 17:03 ` pinskia at gcc dot gnu dot org
  2008-01-04 17:10 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-04 17:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-01-04 16:57 -------
Isn't there already a bug about load PRE with global variables?


-- 


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
  2008-01-04 17:03 ` [Bug tree-optimization/34677] " pinskia at gcc dot gnu dot org
@ 2008-01-04 17:10 ` rguenth at gcc dot gnu dot org
  2008-01-04 17:20 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 17:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-01-04 17:00 -------
The plain DECL does not work because

  1) we don't do the storetmp
  2) can_PRE_operation and can_value_number_operation return false (so we
     do not enter a into EXP_GEN
  3) create_value_expr_from cannot handle it

most of the rest of PRE looks like it may handle DECLs, but if you fix the
above, vn_lookup_with_vuses still not finds VH.10, because it is not ANTIC_IN.


-- 


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
  2008-01-04 17:03 ` [Bug tree-optimization/34677] " pinskia at gcc dot gnu dot org
  2008-01-04 17:10 ` rguenth at gcc dot gnu dot org
@ 2008-01-04 17:20 ` rguenth at gcc dot gnu dot org
  2008-01-04 18:50 ` dberlin at dberlin dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 17:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-01-04 17:03 -------
I think the other PR is only about VN global constants.  But also an incoming
pointer to a structure is not handled:

struct X { int i; };
int foo(struct X *a, int argc)
{
  int b;
  int c;
  int i;
  int d, e;

  for (i = 0; i < argc; i++)
    {
      e = a->i;
      a->i = 9;
    }
  return d + e;
}


-- 


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-04 17:20 ` rguenth at gcc dot gnu dot org
@ 2008-01-04 18:50 ` dberlin at dberlin dot org
  2008-03-10 14:40 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dberlin at dberlin dot org @ 2008-01-04 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dberlin at gcc dot gnu dot org  2008-01-04 17:31 -------
Subject: Re:  PREs insert_fake_stores is mostly useless

FRE will handle DECL's, and VN will value number them.
I've made small attempts at make PRE work with globals, but i'm lazy
and haven't done it for real yet :)
It is trickier than it would initially seem.

On 4 Jan 2008 17:00:21 -0000, rguenth at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #2 from rguenth at gcc dot gnu dot org  2008-01-04 17:00 -------
> The plain DECL does not work because
>
>   1) we don't do the storetmp
>   2) can_PRE_operation and can_value_number_operation return false (so we
>      do not enter a into EXP_GEN
>   3) create_value_expr_from cannot handle it
>
> most of the rest of PRE looks like it may handle DECLs, but if you fix the
> above, vn_lookup_with_vuses still not finds VH.10, because it is not ANTIC_IN.
>
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34677
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-01-04 18:50 ` dberlin at dberlin dot org
@ 2008-03-10 14:40 ` rguenth at gcc dot gnu dot org
  2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
  2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-10 14:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-03-10 14:39 -------
I have a patch for the non-PRE-of-globals part.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-10 14:39:27
               date|                            |


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
@ 2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-10 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-03-10 17:15 -------
Subject: Bug 34677

Author: rguenth
Date: Mon Mar 10 17:14:45 2008
New Revision: 133081

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

        PR tree-optimization/34677
        * tree-ssa-pre.c (modify_expr_node_pool): Remove.
        (poolify_tree): Likewise.
        (modify_expr_template): Likewise.
        (poolify_modify_stmt): Likewise.
        (insert_fake_stores): Handle all component-ref style stores
        in addition to INDIRECT_REF.  Also handle complex types.
        Do not poolify the inserted load.
        (realify_fake_stores): Do not rebuild the tree but only
        make it a SSA_NAME copy.
        (init_pre): Remove initialzation of modify_expr_template.
        Do not allocate modify_expr_node_pool.
        (fini_pre): Do not free modify_expr_node_pool.

        * gcc.dg/tree-ssa/loadpre23.c: New testcase.
        * gcc.dg/tree-ssa/loadpre24.c: Likewise.
        * gcc.dg/tree-ssa/loadpre25.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre23.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre24.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre25.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

* [Bug tree-optimization/34677] PREs insert_fake_stores is mostly useless
  2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-03-10 14:40 ` rguenth at gcc dot gnu dot org
@ 2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
  2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-10 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2008-03-10 17:15 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-03-10 17:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-04 17:01 [Bug tree-optimization/34677] New: PREs insert_fake_stores is mostly useless rguenth at gcc dot gnu dot org
2008-01-04 17:03 ` [Bug tree-optimization/34677] " pinskia at gcc dot gnu dot org
2008-01-04 17:10 ` rguenth at gcc dot gnu dot org
2008-01-04 17:20 ` rguenth at gcc dot gnu dot org
2008-01-04 18:50 ` dberlin at dberlin dot org
2008-03-10 14:40 ` rguenth at gcc dot gnu dot org
2008-03-10 17:16 ` rguenth at gcc dot gnu dot org
2008-03-10 17:16 ` 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).