public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27090]  New: FRE does not value number effective types
@ 2006-04-09  8:41 rguenth at gcc dot gnu dot org
  2006-04-09  8:41 ` [Bug tree-optimization/27090] " rguenth at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-09  8:41 UTC (permalink / raw)
  To: gcc-bugs

Extracted from tramp3d:

template <class T>
struct Bar
{
        int get() { return static_cast<T*>(this)->get2(); }
};
struct Foo : public Bar<Foo>
{
        int get2() { return x; }
        int x;
};

int foo(Foo& f)
{
        return f.get();
}

We end up with

int foo(Foo&) (f)
{
  struct Foo * this.1;
  int D.2027;
  struct Bar<Foo> * f.0;

<bb 2>:
  f.0_2 = (struct Bar<Foo> *) f_1;
  this.1_4 = (struct Foo *) f.0_2;
  D.2027_6 = this.1_4->x;
  return D.2027_6;

}

while we can load x directly from f_1.  This looks like something FRE
should be able to do - tell that f_1 has the same VN as this.1_4 and
(struct Foo *) f.0_2.  Danny - does the new value-numbering catch this
case?  It can even strip const qualifiers for loads from the pointer.


-- 
           Summary: FRE does not value number effective types
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
OtherBugsDependingO 22501
             nThis:


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


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

* [Bug tree-optimization/27090] FRE does not value number effective types
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
@ 2006-04-09  8:41 ` rguenth at gcc dot gnu dot org
  2006-04-09  9:03 ` rguenth at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-09  8:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-04-09 08:41 -------
And of course I again have hacked forwprop to do the transformation for me.


-- 


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


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

* [Bug tree-optimization/27090] FRE does not value number effective types
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
  2006-04-09  8:41 ` [Bug tree-optimization/27090] " rguenth at gcc dot gnu dot org
@ 2006-04-09  9:03 ` rguenth at gcc dot gnu dot org
  2006-04-09 17:40 ` [Bug tree-optimization/27090] FRE does loop past previous type casts pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-09  9:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-04-09 09:03 -------
A quick look at VN doesn't tell me an obvious place where to fix this.  We have

Created value VH.0 for f_1
Created value VH.1 for (struct Bar<Foo> *) VH.0
Created value VH.2 for (struct Foo *) VH.1

where (struct Foo *) VH.1 should have been identified as VH.0.


-- 


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


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

* [Bug tree-optimization/27090] FRE does loop past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
  2006-04-09  8:41 ` [Bug tree-optimization/27090] " rguenth at gcc dot gnu dot org
  2006-04-09  9:03 ` rguenth at gcc dot gnu dot org
@ 2006-04-09 17:40 ` pinskia at gcc dot gnu dot org
  2006-04-10 18:12 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-09 17:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-04-09 17:40 -------
Actually this testcase comes down to:

int f(int *a)
{
  *a = 1;
  unsigned *b = (unsigned *)a;
  int *c = (int*)b;
  return *c;
}

----
And this is caught correctly at the RTL level.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |TREE
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-09 17:40:40
               date|                            |
            Summary|FRE does not value number   |FRE does loop past previous
                   |effective types             |type casts


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


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

* [Bug tree-optimization/27090] FRE does loop past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-04-09 17:40 ` [Bug tree-optimization/27090] FRE does loop past previous type casts pinskia at gcc dot gnu dot org
@ 2006-04-10 18:12 ` pinskia at gcc dot gnu dot org
  2006-04-11  1:12 ` [Bug tree-optimization/27090] FRE does not look " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-10 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-04-10 18:12 -------
Well really more like:
int f(int *a)
{
  int t = *a;
  unsigned *b = (unsigned *)a;
  int *c = (int*)b;
  return *c + t;
}

Which should be the same as:
int f(int *a)
{
  return *a * 2;
}


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-04-10 18:12 ` pinskia at gcc dot gnu dot org
@ 2006-04-11  1:12 ` pinskia at gcc dot gnu dot org
  2006-04-11  1:21 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-11  1:12 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |enhancement


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-04-11  1:12 ` [Bug tree-optimization/27090] FRE does not look " pinskia at gcc dot gnu dot org
@ 2006-04-11  1:21 ` pinskia at gcc dot gnu dot org
  2006-04-11  1:33 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-11  1:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-04-11 01:21 -------
Just a note VN.2 should really have not been created (maybe there is no way
around this because it is just equivalant to VN.0).  This actually gets fixed
by a real tree combiner since fold is able to "fix" up (int*)(unsigned*)intptr
(or the C++ example).


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-04-11  1:21 ` pinskia at gcc dot gnu dot org
@ 2006-04-11  1:33 ` pinskia at gcc dot gnu dot org
  2006-04-20 13:53 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-11  1:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-04-11 01:33 -------
So I talked to Daniel about this and he said a new Number value system or the
tree combiner so basicially there is nothing can be done currently.  Guess
maybe it is time for you Richard to stop hacking on fowardprop and start
hacking on a real tree combiner :) (I don't have time to do it any more).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15459


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-04-11  1:33 ` pinskia at gcc dot gnu dot org
@ 2006-04-20 13:53 ` rguenth at gcc dot gnu dot org
  2006-04-20 13:54 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-20 13:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-04-20 13:52 -------
I have a patch to teach GVN tree-combining.


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-04-20 13:53 ` rguenth at gcc dot gnu dot org
@ 2006-04-20 13:54 ` rguenth at gcc dot gnu dot org
  2006-04-21 14:46 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-20 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-04-20 13:54 -------
Which, for the testcase in comment #4 gives us

;; Function f (f)

Created value VH.0 for a_1
Created value VH.1 for *VH.0 vuses: (SMT.4_8)
Created value VH.2 for (unsigned int *) VH.0
Created value VH.3 for (int *) VH.2
Created value VH.4 for VH.1 + VH.1
Created value VH.5 for <retval>_7
exp_gen[0] := {  }
tmp_gen[0] := { a_1 (VH.0)  }
avail_out[0] := { a_1 (VH.0)  }
exp_gen[2] := { a_1 (VH.0) , *VH.0 (VH.1) , (unsigned int *) VH.0 (VH.2) , (int
*) VH.2 (VH.3) , VH.1 + VH.1 (VH.4)  }
tmp_gen[2] := { t_2 (VH.1) , b_3 (VH.2) , c_4 (VH.3) , D.1527_5 (VH.1) ,
D.1526_6 (VH.4) , <retval>_7 (VH.5)  }
avail_out[2] := { a_1 (VH.0) , t_2 (VH.1) , b_3 (VH.2) , c_4 (VH.3) , D.1526_6
(VH.4) , <retval>_7 (VH.5)  }
exp_gen[1] := {  }
tmp_gen[1] := {  }
avail_out[1] := {  }
Replaced *c_4 with t_2 in D.1527_5 = *c_4;
f (a)
{
  int * c;
  unsigned int * b;
  int t;
  int D.1527;
  int D.1526;

<bb 2>:
  t_2 = *a_1;
  b_3 = (unsigned int *) a_1;
  c_4 = (int *) b_3;
  D.1527_5 = t_2;
  D.1526_6 = D.1527_5 + t_2;
  return D.1526_6;

}


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-04-20 13:54 ` rguenth at gcc dot gnu dot org
@ 2006-04-21 14:46 ` rguenth at gcc dot gnu dot org
  2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-21 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2006-04-21 14:46 -------
Hm, fold_unary does not fold

  (struct FooD.1993 *)(struct Bar<Foo>D.1994 *) f

where f is of type (struct FooD.1993 &).  Oh well.


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-04-21 14:46 ` rguenth at gcc dot gnu dot org
@ 2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
  2006-05-04 15:01 ` rguenth at gcc dot gnu dot org
  2006-06-19 20:15 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-04 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2006-05-04 13:57 -------
Subject: Bug 27090

Author: rguenth
Date: Thu May  4 13:56:52 2006
New Revision: 113527

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

        PR tree-optimization/14287
        PR tree-optimization/14844
        PR tree-optimization/19792
        PR tree-optimization/21608
        PR tree-optimization/27090
        * tree-ssa-pre.c (try_combine_conversion): New function.
        (compute_avail): After constructing the value-handle
        expression, use try_combine_conversion to combine NOP_EXPRs
        with previous value-handle expressions and use the result if it
        is available.

        * gcc.dg/tree-ssa/ssa-fre-1.c: New testcase.
        * gcc.dg/tree-ssa/ssa-fre-2.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-4.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-5.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
@ 2006-05-04 15:01 ` rguenth at gcc dot gnu dot org
  2006-06-19 20:15 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-04 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2006-05-04 15:01 -------
Testcase in comment #4 is fixed, for the original testcase the folding
missed-optimization still holds.  But that's for another bug.

Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
  2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2006-05-04 15:01 ` rguenth at gcc dot gnu dot org
@ 2006-06-19 20:15 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-06-19 20:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenth at gcc dot gnu dot org  2006-06-19 20:10 -------
Subject: Bug 27090

Author: rguenth
Date: Mon Jun 19 20:10:02 2006
New Revision: 114786

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114786
Log:
2006-06-19  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/27090
        * g++.dg/tree-ssa/pr27090.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr27090.C
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug tree-optimization/27090] FRE does not look past previous type casts
       [not found] <bug-27090-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31  4:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27090
Bug 27090 depends on bug 15459, which changed state.

Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459

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


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

end of thread, other threads:[~2014-10-31  4:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-09  8:41 [Bug tree-optimization/27090] New: FRE does not value number effective types rguenth at gcc dot gnu dot org
2006-04-09  8:41 ` [Bug tree-optimization/27090] " rguenth at gcc dot gnu dot org
2006-04-09  9:03 ` rguenth at gcc dot gnu dot org
2006-04-09 17:40 ` [Bug tree-optimization/27090] FRE does loop past previous type casts pinskia at gcc dot gnu dot org
2006-04-10 18:12 ` pinskia at gcc dot gnu dot org
2006-04-11  1:12 ` [Bug tree-optimization/27090] FRE does not look " pinskia at gcc dot gnu dot org
2006-04-11  1:21 ` pinskia at gcc dot gnu dot org
2006-04-11  1:33 ` pinskia at gcc dot gnu dot org
2006-04-20 13:53 ` rguenth at gcc dot gnu dot org
2006-04-20 13:54 ` rguenth at gcc dot gnu dot org
2006-04-21 14:46 ` rguenth at gcc dot gnu dot org
2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
2006-05-04 15:01 ` rguenth at gcc dot gnu dot org
2006-06-19 20:15 ` rguenth at gcc dot gnu dot org
     [not found] <bug-27090-4@http.gcc.gnu.org/bugzilla/>
2014-10-31  4:02 ` pinskia at gcc dot gnu.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).