public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56342] New: MATMUL with PARAMETER: Simplification usually doesn't work
@ 2013-02-15 14:28 burnus at gcc dot gnu.org
  2013-07-08 12:40 ` [Bug fortran/56342] " burnus at gcc dot gnu.org
  2014-01-07 10:38 ` dominiq at lps dot ens.fr
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-02-15 14:28 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56342
           Summary: MATMUL with PARAMETER: Simplification usually doesn't
                    work
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
        Depends on: 56318


This is a follow up to PR 56318, reported by Alberto Luaces at
http://gcc.gnu.org/ml/fortran/2013-02/msg00074.html

The wrong-code issue has been fixed, however, it was noted there that MATMUL
with parameters is not get optimized.


Simplified test case:
!------------------------------------
integer, parameter :: A(3,2) = reshape([1,2,3,4,5,6],[3,2])
integer, parameter :: B(2,3) = reshape([1,1,1,1,1,1],[2,3])
integer, parameter :: m1 = 1

print '(3i3)',    matmul(A,B) ! Does not get optimized
print '(3i3)', m1*matmul(A,B) ! Is optimized
end
!------------------------------------

(See the other PR for the original test case - and gfortran.dg/matmul_9.f90;
they all use the multiplication - which lead to simplification and hit a now
fixed wrong-code bug.)



The "m1*" is crucial. When gfc_simplify_matmul is called initially, it returns
NULL as  "is_constant_array_expr (matrix_a)" is false.

The "m1*" causes a re-evaluation of the RHS expression, namely in
gfc_simplify_expr:
      for (ap = p->value.function.actual; ap; ap = ap->next)
        if (gfc_simplify_expr (ap->expr, type) == FAILURE)

That converts an EXPR_VARIABLE with flavor FL_PARAMETER into an EXPR_ARRAY,
which can then be processed by calling gfc_simplify_matmul.



It seems as if one has to run "gfc_simplify_expr" – the question is whether
that shouldn't then also be done for other intrinsics?


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

* [Bug fortran/56342] MATMUL with PARAMETER: Simplification usually doesn't work
  2013-02-15 14:28 [Bug fortran/56342] New: MATMUL with PARAMETER: Simplification usually doesn't work burnus at gcc dot gnu.org
@ 2013-07-08 12:40 ` burnus at gcc dot gnu.org
  2014-01-07 10:38 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-08 12:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Another example: http://gcc.gnu.org/ml/fortran/2013-07/msg00005.html - Here,
the SUM is not simplified.


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

* [Bug fortran/56342] MATMUL with PARAMETER: Simplification usually doesn't work
  2013-02-15 14:28 [Bug fortran/56342] New: MATMUL with PARAMETER: Simplification usually doesn't work burnus at gcc dot gnu.org
  2013-07-08 12:40 ` [Bug fortran/56342] " burnus at gcc dot gnu.org
@ 2014-01-07 10:38 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-07 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-07
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still true at r206385.


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

end of thread, other threads:[~2014-01-07 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 14:28 [Bug fortran/56342] New: MATMUL with PARAMETER: Simplification usually doesn't work burnus at gcc dot gnu.org
2013-07-08 12:40 ` [Bug fortran/56342] " burnus at gcc dot gnu.org
2014-01-07 10:38 ` dominiq at lps dot ens.fr

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).