public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32390]  New: tree-ssa-math-opts.c performs too many IL scans
@ 2007-06-18 12:21 dnovillo at gcc dot gnu dot org
  2007-06-18 13:56 ` [Bug tree-optimization/32390] " rguenth at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2007-06-18 12:21 UTC (permalink / raw)
  To: gcc-bugs

In tree-ssa-math-opts.c we already had a pass to cse sin and cos.  The new
reciprocal sqrt pass is mechanically similar to that one.  It does a linear
scan over the CFG applying these peephole transformations.  This new pass
should not be doing a separate IL scan to do its job.

Perhaps it would be a good idea to do a single scan that calls back to
all these transformations on every statement?  I realize that each pass
requires its own setup and may need to do things a bit differently, but
perhaps we can save ourselves multiple IL scans if we generalize it a bit.


-- 
           Summary: tree-ssa-math-opts.c performs too many IL scans
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dnovillo at gcc dot gnu dot org


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
@ 2007-06-18 13:56 ` rguenth at gcc dot gnu dot org
  2007-06-18 14:00 ` dnovillo at google dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-18 13:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-06-18 13:56 -------
All three transformations are done at different stages of the optimization
pipeline due to various reasons.


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
  2007-06-18 13:56 ` [Bug tree-optimization/32390] " rguenth at gcc dot gnu dot org
@ 2007-06-18 14:00 ` dnovillo at google dot com
  2007-06-18 17:40 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at google dot com @ 2007-06-18 14:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dnovillo at google dot com  2007-06-18 14:00 -------
Subject: Re:  tree-ssa-math-opts.c performs too
 many IL scans

On 6/18/07 9:56 AM, rguenth at gcc dot gnu dot org wrote:
> ------- Comment #1 from rguenth at gcc dot gnu dot org  2007-06-18 13:56 -------
> All three transformations are done at different stages of the optimization
> pipeline due to various reasons.

We need a better explanation than this.  Uros agreed to summarize the
IRC discussion to close this issue.  It'd be useful if we keep that same
discussion on the source code itself.


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
  2007-06-18 13:56 ` [Bug tree-optimization/32390] " rguenth at gcc dot gnu dot org
  2007-06-18 14:00 ` dnovillo at google dot com
@ 2007-06-18 17:40 ` ubizjak at gmail dot com
  2007-06-19  5:09 ` paolo dot bonzini at lu dot unisi dot ch
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2007-06-18 17:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2007-06-18 17:40 -------
(In reply to comment #2)

> We need a better explanation than this.  Uros agreed to summarize the
> IRC discussion to close this issue.  It'd be useful if we keep that same
> discussion on the source code itself.

The need for separate IL passes could be explained by:

We have reciprocal pass (in fact CSE recip pass) that CSEs 1.0/z from x/z, y/z,
.../z. This is done by scanning function for RDIV_EXPR, where denominator (z)
is the same. If 1.0/func() -> rfunc() conversion is done before recip pass, we
loose the ability to scan for RDIV_EXPRs and the ability to CSE the division.

By putting 1.0/func()->rfunc() after recip pass, we simply run another scan for
RDIV_EXPRs with function as their argument. Note that we already CSE'd
1.0/func(), so the conversion into rfunc() is trivial. This is the reason why
function recip pass needs to run after recip (aka CSE recip) pass.

Next convesion is sqrt(a/b) -> rsqrt(b/a) conversion that runs after rfunc
recip pass as a separate pass (so, in the function granulartiy). If this pass
is run together or before rfunc pass, then rsqrt pass would convert expressions
like 1.0/sqrt(a/b) into 1.0/rsqrt(b/a). There is no point for rfunc pass (that
would follow) to convert this to sqrt(b/a).


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-18 17:40 ` ubizjak at gmail dot com
@ 2007-06-19  5:09 ` paolo dot bonzini at lu dot unisi dot ch
  2009-02-06 21:41 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot bonzini at lu dot unisi dot ch @ 2007-06-19  5:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot bonzini at lu dot unisi dot ch  2007-06-19 05:09 -------
Subject: Re:  tree-ssa-math-opts.c performs too
 many IL scans


> We have reciprocal pass (in fact CSE recip pass) that CSEs 1.0/z from x/z, y/z,
> .../z. This is done by scanning function for RDIV_EXPR, where denominator (z)
> is the same. If 1.0/func() -> rfunc() conversion is done before recip pass, we
> loose the ability to scan for RDIV_EXPRs and the ability to CSE the division.

You could still use a pointer_set or pointer_map to save where the 
RDIV_EXPRs are and avoid scanning the IL twice.

Paolo


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-06-19  5:09 ` paolo dot bonzini at lu dot unisi dot ch
@ 2009-02-06 21:41 ` steven at gcc dot gnu dot org
  2009-02-06 22:29 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-02-06 21:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2009-02-06 21:41 -------
We have a new candidate: bswap optimization.

Diego's idea to do "a single scan that calls back to all these transformations
on every statement" really still sounds like The Right Thing to do.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |compile-time-hog
   Last reconfirmed|0000-00-00 00:00:00         |2009-02-06 21:41:34
               date|                            |


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-02-06 21:41 ` steven at gcc dot gnu dot org
@ 2009-02-06 22:29 ` rguenth at gcc dot gnu dot org
  2009-02-06 22:43 ` steven at gcc dot gnu dot org
  2009-02-06 22:51 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-06 22:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-02-06 22:29 -------
Only they all run at different times during the pass pipeline ;)


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-02-06 22:29 ` rguenth at gcc dot gnu dot org
@ 2009-02-06 22:43 ` steven at gcc dot gnu dot org
  2009-02-06 22:51 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-02-06 22:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from steven at gcc dot gnu dot org  2009-02-06 22:43 -------
Then they should be grouped. And kept grouped.

Here's one case where there has to be a trade-off between micro-optimizations
for specific cases, and compile time for everyone.  Please, for once, let us
seriously consider this trade-off.


-- 


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


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

* [Bug tree-optimization/32390] tree-ssa-math-opts.c performs too many IL scans
  2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-02-06 22:43 ` steven at gcc dot gnu dot org
@ 2009-02-06 22:51 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-06 22:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-02-06 22:51 -------
Sure.  There's this other problem of testsuite regressions you'll get.  I've
been
there, it takes a _lot_ of time to do even minimal pass re-ordering / removing
:(

The best strathegy was always to fix deficiencies in passes to not need
followup
ones or iterating.


-- 


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


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

end of thread, other threads:[~2009-02-06 22:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18 12:21 [Bug tree-optimization/32390] New: tree-ssa-math-opts.c performs too many IL scans dnovillo at gcc dot gnu dot org
2007-06-18 13:56 ` [Bug tree-optimization/32390] " rguenth at gcc dot gnu dot org
2007-06-18 14:00 ` dnovillo at google dot com
2007-06-18 17:40 ` ubizjak at gmail dot com
2007-06-19  5:09 ` paolo dot bonzini at lu dot unisi dot ch
2009-02-06 21:41 ` steven at gcc dot gnu dot org
2009-02-06 22:29 ` rguenth at gcc dot gnu dot org
2009-02-06 22:43 ` steven at gcc dot gnu dot org
2009-02-06 22:51 ` 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).