public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-07 19:55 ` tkoenig at gcc dot gnu.org
  2011-03-07 21:03 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-03-07 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-03-07 19:55:25 UTC ---
Created attachment 23575
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23575
proposed patch (partial)

Here is a patch which optimizes the case for arguments of
matmul which have known sizes at compile time.


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
  2011-03-07 19:55 ` [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised tkoenig at gcc dot gnu.org
@ 2011-03-07 21:03 ` tkoenig at gcc dot gnu.org
  2011-03-08  3:14 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-03-07 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23575|0                           |1
        is obsolete|                            |

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-03-07 21:02:49 UTC ---
Created attachment 23577
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23577
Updated patch

This one doesn't cause any regressions.


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
  2011-03-07 19:55 ` [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised tkoenig at gcc dot gnu.org
  2011-03-07 21:03 ` tkoenig at gcc dot gnu.org
@ 2011-03-08  3:14 ` jvdelisle at gcc dot gnu.org
  2011-03-08  7:20 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-03-08  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-03-08 03:14:18 UTC ---
I think this is too close to 4.6 release, but definitely 4.7 and then with some
time, a possible backport to 4.6.  If others feel it is safe, please say so.


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-03-08  3:14 ` jvdelisle at gcc dot gnu.org
@ 2011-03-08  7:20 ` burnus at gcc dot gnu.org
  2011-03-21  8:19 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-03-08  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-08 07:19:40 UTC ---
Definitely after 4.6 (which presumably branched this week). As it is only a
missed optimization, I would not even back port it.

Otherwise: Nice patch!


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-03-08  7:20 ` burnus at gcc dot gnu.org
@ 2011-03-21  8:19 ` tkoenig at gcc dot gnu.org
  2011-04-22 15:58 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-03-21  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-03-21 07:14:46 UTC ---
Author: tkoenig
Date: Mon Mar 21 07:14:42 2011
New Revision: 171207

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171207
Log:
2010-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/22572
    * gfortran.h (gfc_option_t) : Add
    flag_aggressive_function_elimination.
    (gfc_dep_compare_functions):  Add prototype.
    * lang.opt: Add faggressive-function-elimination.
    * invoke.texi: Document -faggressive-function-elimination.
    * frontend_passes (expr_array):  New static variable.
    (expr_size):  Likewise.
    (expr_count):  Likewise.
    (current_code):  Likewise.
    (current_ns):  Likewise.
    (gfc_run_passes):  Allocate and free space for expressions.
    (cfe_register_funcs):  New function.
    (create_var):  New function.
    (cfc_expr_0):  New function.
    (cfe_code):  New function.
    (optimize_namespace):  Invoke gfc_code_walker with cfe_code
    and cfe_expr_0.
    * dependency.c (gfc_dep_compare_functions):  New function.
    (gfc_dep_compare_expr):  Use it.
    * options.c (gfc_init_options):  Handle
    flag_aggressive_function_elimination.
    (gfc_handle_option):  Likewise.

2010-03-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/22572
    * gfortran.dg/function_optimize_1.f90:  New test.
    * gfortran.dg/function_optimize_2.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/function_optimize_1.f90
    trunk/gcc/testsuite/gfortran.dg/function_optimize_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-03-21  8:19 ` tkoenig at gcc dot gnu.org
@ 2011-04-22 15:58 ` tkoenig at gcc dot gnu.org
  2011-05-14  9:58 ` tkoenig at gcc dot gnu.org
  2011-05-14 10:06 ` tkoenig at gcc dot gnu.org
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-04-22 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-04-22 15:57:01 UTC ---
We should generate

function optmatmul (a, b, c, m, n, count)
  implicit none  
  integer, intent(in) :: m, n, count
  double precision :: optmatmul(m, n)  
  double precision, intent(in) :: a(m, count), b(count, n), c(m, n)
  block
    double precision, dimension(size(a,1), size(b,2)) :: tmp
    tmp = matmul(a,b)
    optmatmul = tmp / (1 + tmp)
  end block
end function optmatmul  

I forsee lots of special-casing here...


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-04-22 15:58 ` tkoenig at gcc dot gnu.org
@ 2011-05-14  9:58 ` tkoenig at gcc dot gnu.org
  2011-05-14 10:06 ` tkoenig at gcc dot gnu.org
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-05-14  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-05-14 09:48:11 UTC ---
Author: tkoenig
Date: Sat May 14 09:48:08 2011
New Revision: 173752

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173752
Log:
2011-05-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/22572
    * frontend-passes.c (cfe_register_funcs):  Also register functions
    for potential elimination if the rank is > 0, the shape is unknown
    and reallocate on assignment is active.
    (create_var):  For rank > 0 functions with unknown shape, create
    an allocatable temporary.

2011-05-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/22572
    * function_optimize_7.f90:  New test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/function_optimize_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
       [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2011-05-14  9:58 ` tkoenig at gcc dot gnu.org
@ 2011-05-14 10:06 ` tkoenig at gcc dot gnu.org
  7 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-05-14 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-05-14 09:50:46 UTC ---
Fixed on trunk.

Closing.


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
  2005-07-20 17:50 [Bug fortran/22572] New: " schnetter at aei dot mpg dot de
  2005-07-20 17:54 ` [Bug fortran/22572] " schnetter at aei dot mpg dot de
  2005-07-20 18:02 ` pinskia at gcc dot gnu dot org
@ 2005-07-21  5:12 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-21  5:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-21 05:08 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-21 05:08:29
               date|                            |


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


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
  2005-07-20 17:50 [Bug fortran/22572] New: " schnetter at aei dot mpg dot de
  2005-07-20 17:54 ` [Bug fortran/22572] " schnetter at aei dot mpg dot de
@ 2005-07-20 18:02 ` pinskia at gcc dot gnu dot org
  2005-07-21  5:12 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-20 18:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization


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


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

* [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised
  2005-07-20 17:50 [Bug fortran/22572] New: " schnetter at aei dot mpg dot de
@ 2005-07-20 17:54 ` schnetter at aei dot mpg dot de
  2005-07-20 18:02 ` pinskia at gcc dot gnu dot org
  2005-07-21  5:12 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 11+ messages in thread
From: schnetter at aei dot mpg dot de @ 2005-07-20 17:54 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

end of thread, other threads:[~2011-05-14  9:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-22572-4@http.gcc.gnu.org/bugzilla/>
2011-03-07 19:55 ` [Bug fortran/22572] Double occurrence of matmul intrinsic not optimised tkoenig at gcc dot gnu.org
2011-03-07 21:03 ` tkoenig at gcc dot gnu.org
2011-03-08  3:14 ` jvdelisle at gcc dot gnu.org
2011-03-08  7:20 ` burnus at gcc dot gnu.org
2011-03-21  8:19 ` tkoenig at gcc dot gnu.org
2011-04-22 15:58 ` tkoenig at gcc dot gnu.org
2011-05-14  9:58 ` tkoenig at gcc dot gnu.org
2011-05-14 10:06 ` tkoenig at gcc dot gnu.org
2005-07-20 17:50 [Bug fortran/22572] New: " schnetter at aei dot mpg dot de
2005-07-20 17:54 ` [Bug fortran/22572] " schnetter at aei dot mpg dot de
2005-07-20 18:02 ` pinskia at gcc dot gnu dot org
2005-07-21  5:12 ` 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).