public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26629]  New: tree load PRE does not work on array references
@ 2006-03-10  5:31 pinskia at gcc dot gnu dot org
  2006-03-10 12:50 ` [Bug tree-optimization/26629] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-10  5:31 UTC (permalink / raw)
  To: gcc-bugs

While Looking into PR 21485, I noticed this.  This might come up more with the
array references for pointers patch.

Testcase:
typedef long dtype;
typedef dtype longarray[];
int g (longarray *array1, unsigned long i, dtype j)
{
  if ((*array1)[i] < (*array1)[i + 1])
      ++i;
  if (j < (*array1)[i])
    h();
  return i;
}
int g2 (longarray *array1, unsigned long i, dtype j)
{
  dtype a = (*array1)[i];
  dtype b = (*array1)[i + 1];
  dtype c = a;
  if (a < b) ++i, c = b;
  if (j < c)
    h();
  return i;
}

g2 is the optimized version of g.  If I remove the "return i", the RTL level
optimizations catches it.


-- 
           Summary: tree load PRE does not work on array references
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         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=26629


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
@ 2006-03-10 12:50 ` pinskia at gcc dot gnu dot org
  2006-03-10 12:59 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-10 12:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-10 12:50 -------
Here is another testcase:
typedef long dtype;
typedef dtype longarray[];
int g (longarray *array1, unsigned long i, dtype j)
{
  if (!(*array1)[i])
    i++;
  if (j < (*array1)[i])
    h();
  return i;
}

int g1 (longarray *array1, unsigned long i, dtype j)
{
  dtype a = (*array1)[i];
  if (!a)
    {
      i++;
      a = (*array1)[i];
    }
  if (j < a)
    h();
  return i;
}

FRE handles this just fine, it is PRE which does not.


-- 


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


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
  2006-03-10 12:50 ` [Bug tree-optimization/26629] " pinskia at gcc dot gnu dot org
@ 2006-03-10 12:59 ` pinskia at gcc dot gnu dot org
  2006-03-11 22:07 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-10 12:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-10 12:59 -------
(In reply to comment #1)
> FRE handles this just fine, it is PRE which does not.
Let me clarify that comment, For FRE I am talking about code like:
typedef long dtype;
typedef dtype longarray[];
int g (longarray *array1, unsigned long i, dtype j)
{
  if (!(*array1)[i])
    j++;
  if (j < (*array1)[i])
    h();
  return i;
}


-- 


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


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
  2006-03-10 12:50 ` [Bug tree-optimization/26629] " pinskia at gcc dot gnu dot org
  2006-03-10 12:59 ` pinskia at gcc dot gnu dot org
@ 2006-03-11 22:07 ` pinskia at gcc dot gnu dot org
  2006-03-17 16:11 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-11 22:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-03-11 22:07 -------
I have a patch.  Thanks Daniel for recommending places to look to change.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-11 22:07:37
               date|                            |


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


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-03-11 22:07 ` pinskia at gcc dot gnu dot org
@ 2006-03-17 16:11 ` pinskia at gcc dot gnu dot org
  2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
  2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-17 16:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-03-17 16:11 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01110.html


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |03/msg01110.html
           Keywords|                            |patch


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


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-03-17 16:11 ` pinskia at gcc dot gnu dot org
@ 2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
  2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-20 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-03-20 21:00 -------
Fixed in rev 112227.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/26629] tree load PRE does not work on array references
  2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
@ 2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-20 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-03-20 21:00 -------
Subject: Bug 26629

Author: pinskia
Date: Mon Mar 20 21:00:18 2006
New Revision: 112227

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112227
Log:
2006-03-20  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/26629
        * tree-ssa-pre (phi_translate): Handle ARRAY_REF's operands.
        (valid_in_set): Handle ARRAY_REF.
        Change "if min_variant or VH" to asserts.
        (create_component_ref_by_pieces): Handle ARRAY_REF.
        (create_expression_by_pieces): Likewise.
        (can_PRE_operation): ARRAY_REFs can now be PRE'd.

2006-03-20  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/26629
        * gcc.dg/tree-ssa/loadpre12.c: New test.
        * gcc.dg/tree-ssa/loadpre13.c: New test.
        * gcc.dg/tree-ssa/loadpre14.c: New test.
        * gcc.dg/tree-ssa/loadpre15.c: New test.
        * gcc.dg/tree-ssa/loadpre16.c: New test.
        * gcc.dg/tree-ssa/loadpre17.c: New test.
        * gcc.dg/tree-ssa/loadpre18.c: New test.
        * gcc.dg/tree-ssa/loadpre19.c: New test.
        * gcc.dg/tree-ssa/loadpre20.c: New test.
        * gcc.dg/tree-ssa/loadpre21.c: New test.
        * gcc.dg/tree-ssa/loadpre22.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre12.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre13.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre15.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre16.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre17.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre18.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre19.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre20.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre21.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loadpre22.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

end of thread, other threads:[~2006-03-20 21:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-10  5:31 [Bug tree-optimization/26629] New: tree load PRE does not work on array references pinskia at gcc dot gnu dot org
2006-03-10 12:50 ` [Bug tree-optimization/26629] " pinskia at gcc dot gnu dot org
2006-03-10 12:59 ` pinskia at gcc dot gnu dot org
2006-03-11 22:07 ` pinskia at gcc dot gnu dot org
2006-03-17 16:11 ` pinskia at gcc dot gnu dot org
2006-03-20 21:00 ` pinskia at gcc dot gnu dot org
2006-03-20 21:00 ` 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).