public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
       [not found] <bug-43665-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-16 16:06 ` tkoenig at gcc dot gnu.org
  2012-06-29 17:32 ` mikael at gcc dot gnu.org
  2013-06-25  9:02 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 24+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-10-16 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-10-16 16:06:16 UTC ---
Author: tkoenig
Date: Sat Oct 16 16:06:07 2010
New Revision: 165559

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

    PR fortran/20165
    PR fortran/31593
    PR fortran/43665
    * gfortran.map:  Add _gfortran_transfer_array_write,
    _gfortran_transfer_array_write, _gfortran_transfer_character_write,
    _gfortran_transfer_character_wide_write,
    _gfortran_transfer_complex_write,
    _gfortran_transfer_integer_write,
    _gfortran_transfer_logical_write and
    _gfortran_transfer_real_write.
    * io/transfer.c (transfer_integer_write):  Add prototype and
    function body as call to the original function, without the
    _write.
    (transfer_real_write):  Likewise.
    (transfer_logical_write):  Likewise.
    (transfer_character_write):  Likewise.
    (transfer_character_wide_write):  Likewise.
    (transfer_complex_write):  Likewise.
    (transfer_array_write):  Likewise.

2010-10-16  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/20165
    PR fortran/31593
    PR fortran/43665
    * trans-io.c (enum iocall): Add IOCALL_X_INTEGER_WRITE,
    IOCALL_X_LOGICAL_WRITE, IOCALL_X_CHARACTER_WRITE,
    IOCALL_X_CHARACTER_WIDE_WRIE, IOCALL_X_REAL_WRITE,
    IOCALL_X_COMPLEX_WRITE and IOCALL_X_ARRAY_WRITE.
    (gfc_build_io_library_fndecls):  Add corresponding function
    decls.
    (transfer_expr):  If the current transfer is a READ, use
    the iocall with the original version, otherwise the version
    with _WRITE.
    (transfer_array_desc):  Likewise.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-io.c
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/gfortran.map
    trunk/libgfortran/io/transfer.c


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
       [not found] <bug-43665-4@http.gcc.gnu.org/bugzilla/>
  2010-10-16 16:06 ` [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments tkoenig at gcc dot gnu.org
@ 2012-06-29 17:32 ` mikael at gcc dot gnu.org
  2013-06-25  9:02 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 24+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-06-29 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

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

--- Comment #28 from Mikael Morin <mikael at gcc dot gnu.org> 2012-06-29 17:31:19 UTC ---
Can this be closed?


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
       [not found] <bug-43665-4@http.gcc.gnu.org/bugzilla/>
  2010-10-16 16:06 ` [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments tkoenig at gcc dot gnu.org
  2012-06-29 17:32 ` mikael at gcc dot gnu.org
@ 2013-06-25  9:02 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 24+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-25  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #29 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Can this be closed?

No answer since almost a year. Closing as FIXED.


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (19 preceding siblings ...)
  2010-09-12 10:14 ` dominiq at lps dot ens dot fr
@ 2010-09-16 21:30 ` burnus at gcc dot gnu dot org
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-16 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from burnus at gcc dot gnu dot org  2010-09-16 21:30 -------
Subject: Bug 43665

Author: burnus
Date: Thu Sep 16 21:30:05 2010
New Revision: 164348

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164348
Log:
2010-09-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/43665
        * trans-types.c (create_fn_spec): New function.
        (gfc_get_function_type): Call it.

2010-09-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/43665
        * gfortran.dg/cray_pointers_2.f90: Disable inlining to avoid
        optimizations.
        * gfortran.dg/intent_optimize_1.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/cray_pointers_2.f90


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (18 preceding siblings ...)
  2010-09-12  9:32 ` burnus at gcc dot gnu dot org
@ 2010-09-12 10:14 ` dominiq at lps dot ens dot fr
  2010-09-16 21:30 ` burnus at gcc dot gnu dot org
  20 siblings, 0 replies; 24+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-09-12 10:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from dominiq at lps dot ens dot fr  2010-09-12 10:13 -------
> -  create_fn_spec (sym, type);
> +  type = create_fn_spec (sym, type);
> 
> as in the original patch.

With this change the test succeeds.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (17 preceding siblings ...)
  2010-09-11 15:13 ` dominiq at lps dot ens dot fr
@ 2010-09-12  9:32 ` burnus at gcc dot gnu dot org
  2010-09-12 10:14 ` dominiq at lps dot ens dot fr
  2010-09-16 21:30 ` burnus at gcc dot gnu dot org
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-12  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from burnus at gcc dot gnu dot org  2010-09-12 09:32 -------
(In reply to comment #23)
> I have applied the patch in comment #21 without regression, but the test case
> from attachment 21265 [edit] fails:

-  create_fn_spec (sym, type);
+  type = create_fn_spec (sym, type);

as in the original patch.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2010-09-10 12:12 ` burnus at gcc dot gnu dot org
@ 2010-09-11 15:13 ` dominiq at lps dot ens dot fr
  2010-09-12  9:32 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-09-11 15:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from dominiq at lps dot ens dot fr  2010-09-11 15:12 -------
I have applied the patch in comment #21 without regression, but the test case
from attachment 21265 fails:

FAIL: gfortran.dg/intent_optimize_1.f90  -O  scan-tree-dump-times optimized
"does_not_exist" 0


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2010-09-10 12:09 ` burnus at gcc dot gnu dot org
@ 2010-09-10 12:12 ` burnus at gcc dot gnu dot org
  2010-09-11 15:13 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-10 12:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from burnus at gcc dot gnu dot org  2010-09-10 12:12 -------
(In reply to comment #21)
> Created an attachment (id=21765)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21765&action=view) [edit]
> Updated patch

Note: I forgot to include the test case from attachment 21265


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2010-09-09  8:43 ` burnus at gcc dot gnu dot org
@ 2010-09-10 12:09 ` burnus at gcc dot gnu dot org
  2010-09-10 12:12 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-10 12:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from burnus at gcc dot gnu dot org  2010-09-10 12:09 -------
Created an attachment (id=21765)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21765&action=view)
Updated patch

Updated patch to fix review issues and the Cray patch issue. I won't be able to
work on this (i.e. regtest + submit) for the next days thus I put it here.

Cf. http://gcc.gnu.org/ml/fortran/2010-09/msg00198.html
and http://gcc.gnu.org/ml/fortran/2010-09/msg00234.html


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2010-09-08  6:25 ` burnus at gcc dot gnu dot org
@ 2010-09-09  8:43 ` burnus at gcc dot gnu dot org
  2010-09-10 12:09 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-09  8:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from burnus at gcc dot gnu dot org  2010-09-09 08:43 -------
Subject: Bug 43665

Author: burnus
Date: Thu Sep  9 08:42:52 2010
New Revision: 164052

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164052
Log:
2010-09-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/43665
        * intrincic.texi (FGET, FGETC, FPUT, FPUTC, FSTAT, GETCWD, KILL,
        STAT): Show also syntax for the function version.
        * intrinsic.c (add_sym_1s_intent, add_sym_2s_intent,
         add_sym_3s_intent): Remove function.
        (add_sym_1s, add_sym_2s, add_sym_3s): Take always the intent
        as argument.
        (add_sym_2_intent): New function.
        (add_functions): Set intent for functions which modify
        the argument: fstat, fgetc, fget, hostnm, lstat, stat. Change
        argument name of hostnm from "a" to "c"
        (add_subroutines): Change add_sym_*s_intent to
        add_sym_*s and add intent to the add_sym_*s calls. 


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.texi


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2010-09-07 17:01 ` jamborm at gcc dot gnu dot org
@ 2010-09-08  6:25 ` burnus at gcc dot gnu dot org
  2010-09-09  8:43 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-08  6:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from burnus at gcc dot gnu dot org  2010-09-08 06:25 -------
Reviewed patch ("OK") available at
  http://gcc.gnu.org/ml/fortran/2010-09/msg00198.html
however, it causes regressions as some of the intrinsics (in intrinsic.c) have
the wrong intents - which causes wrong code (too much optimized away). Thus,
one first needs to audit and fix intrinsic.c before this patch can be
committed.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2010-09-06 18:44 ` burnus at gcc dot gnu dot org
@ 2010-09-07 17:01 ` jamborm at gcc dot gnu dot org
  2010-09-08  6:25 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2010-09-07 17:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jamborm at gcc dot gnu dot org  2010-09-07 17:01 -------
Subject: Bug 43665

Author: jamborm
Date: Tue Sep  7 17:00:44 2010
New Revision: 163960

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163960
Log:
2010-09-07  Martin Jambor  <mjambor@suse.cz>

        PR fortran/43665
        * ipa-cp.c (ipcp_versionable_function_p): Return false if there
        are any type attributes.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-cp.c


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2010-09-06 18:26 ` jamborm at gcc dot gnu dot org
@ 2010-09-06 18:44 ` burnus at gcc dot gnu dot org
  2010-09-07 17:01 ` jamborm at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-09-06 18:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from burnus at gcc dot gnu dot org  2010-09-06 18:43 -------
(In reply to comment #16)
> This patch makes IPA-CP to refrain from modifying a function when it
> sees a any type attributes.

In a way that's unfortunate: Both "fn attr" and argument removal are
optimization options.

> As far as I understand it there is already a test in our testsuite
> that fails (with the patch from comment #7 applied) and so I am not
> going to add an extra one.

OK.

> I think it's best to check this in separately and I will submit it for
> approval tomorrow if there are no unforeseen problems.

I will also submit my patch - for committal after yours is in.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2010-09-06 14:14 ` jamborm at gcc dot gnu dot org
@ 2010-09-06 18:26 ` jamborm at gcc dot gnu dot org
  2010-09-06 18:44 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2010-09-06 18:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jamborm at gcc dot gnu dot org  2010-09-06 18:25 -------
Created an attachment (id=21714)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21714&action=view)
Patch to address IPA-CP parameter removal issues

This patch makes IPA-CP to refrain from modifying a function when it
sees a any type attributes.  It fixes the test case.  I do not expect
it to cause any problems elsewhere but I have not yet bootstrapped or
tested it (I have just scheduled both for tonight).

As far as I understand it there is already a test in our testsuite
that fails (with the patch from comment #7 applied) and so I am not
going to add an extra one.

I think it's best to check this in separately and I will submit it for
approval tomorrow if there are no unforeseen problems.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-07-22 15:36 ` burnus at gcc dot gnu dot org
@ 2010-09-06 14:14 ` jamborm at gcc dot gnu dot org
  2010-09-06 18:26 ` jamborm at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2010-09-06 14:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jamborm at gcc dot gnu dot org  2010-09-06 14:12 -------
I tried compiling the testcase from comment #8 and it did not fail for
me either on i686-linux ox x86_64-linux.  Can you please check that it
still fails for you?


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-07-21  8:27 ` jamborm at gcc dot gnu dot org
@ 2010-07-22 15:36 ` burnus at gcc dot gnu dot org
  2010-09-06 14:14 ` jamborm at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-22 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from burnus at gcc dot gnu dot org  2010-07-22 15:36 -------
(In reply to comment #13)
> (In reply to comment #12)
> IPA-CP can do that for quite some time please try with -fno-ipa-cp.

As expected: It works with -fno-ipa-cp.


> (I don't have a trunk built with enabled fortran at hand and I am a
> bit overwhelmed with bugs and other stuff recently so I can have a
> look at this but it will take at least a few days before I get to it.)

Thanks.

Some pre-analysis: The "fn spec" (the space is there to prevent other than
internal use - thus I cannot create a C test case) is converted in gimple.c's
gimple_call_arg_flags to EAF_* constants.

tree-ssa-structalias.c's handle_rhs_call uses them via:
  for (i = 0; i < gimple_call_num_args (stmt); ++i)
      [...]
      int flags = gimple_call_arg_flags (stmt, i);
thus, the position seems to matter here.

The latter is called by find_func_aliases in an "if (!in_ipa_mode ..." block.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-07-21  8:09 ` rguenther at suse dot de
@ 2010-07-21  8:27 ` jamborm at gcc dot gnu dot org
  2010-07-22 15:36 ` burnus at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2010-07-21  8:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jamborm at gcc dot gnu dot org  2010-07-21 08:27 -------
(In reply to comment #12)
> So I wonder what code removes the arguments then.
> 

IPA-CP can do that for quite some time please try with -fno-ipa-cp.

(I don't have a trunk built with enabled fortran at hand and I am a
bit overwhelmed with bugs and other stuff recently so I can have a
look at this but it will take at least a few days before I get to it.)


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-07-20 16:12 ` burnus at gcc dot gnu dot org
@ 2010-07-21  8:09 ` rguenther at suse dot de
  2010-07-21  8:27 ` jamborm at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: rguenther at suse dot de @ 2010-07-21  8:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenther at suse dot de  2010-07-21 08:09 -------
Subject: Re:  INTENT(IN) etc. optimization of calls:
 function annotations for noclobber/noescape arguments

On Tue, 20 Jul 2010, burnus at gcc dot gnu dot org wrote:

> ------- Comment #11 from burnus at gcc dot gnu dot org  2010-07-20 16:12 -------
> (In reply to comment #10)
> > No, this problem was present for ipa-sra, but I thought it was fixed.
> > Does -fno-ipa-sra help?
> 
> No, it doesn't. But with that option, the number of arguments still reduces
> from 4 to 2 (before: 1). But again, the code works if one reorders the
> arguments such that the "w" attribute matches the "x" argument (now at position
> 2 instead of 1).

So I wonder what code removes the arguments then.

Richard.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-20 16:01 ` rguenth at gcc dot gnu dot org
@ 2010-07-20 16:12 ` burnus at gcc dot gnu dot org
  2010-07-21  8:09 ` rguenther at suse dot de
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-20 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from burnus at gcc dot gnu dot org  2010-07-20 16:12 -------
(In reply to comment #10)
> No, this problem was present for ipa-sra, but I thought it was fixed.
> Does -fno-ipa-sra help?

No, it doesn't. But with that option, the number of arguments still reduces
from 4 to 2 (before: 1). But again, the code works if one reorders the
arguments such that the "w" attribute matches the "x" argument (now at position
2 instead of 1).


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-20 15:58 ` burnus at gcc dot gnu dot org
@ 2010-07-20 16:01 ` rguenth at gcc dot gnu dot org
  2010-07-20 16:12 ` burnus at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-20 16:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2010-07-20 16:01 -------
No, this problem was present for ipa-sra, but I thought it was fixed.

Does -fno-ipa-sra help?  Martin?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-20 15:26 ` burnus at gcc dot gnu dot org
@ 2010-07-20 15:58 ` burnus at gcc dot gnu dot org
  2010-07-20 16:01 ` rguenth at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-20 15:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2010-07-20 15:58 -------
The procedure 'checkoptional' gets '.rrrw' set as the fn spec.

With -O1, the if after the first "checkoptional" gets properly optimized away
(cf. comment 7 and original test case).

With -O2, the number of arguments is reduced to one (NULL vs. &b) and the
condition
  if (b /= 46) error stop 1
is changed to
  error stop 1
(cf. -fdump-tree-optimized)

For me it looks as if the "fn spec" information is not moved along when
arguments are eliminated but remain at the previous position. It works if one
swaps the order (i.e. it works if the optional argument is at position one).

Richard, does this make sense or am I completely off track?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
  2010-07-13 17:32 ` [Bug fortran/43665] INTENT(IN) etc. optimization of " burnus at gcc dot gnu dot org
  2010-07-20 15:06 ` burnus at gcc dot gnu dot org
@ 2010-07-20 15:26 ` burnus at gcc dot gnu dot org
  2010-07-20 15:58 ` burnus at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-20 15:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2010-07-20 15:26 -------
Reduced test case (of allocatable_scalar_4.f90) - fails with "ERROR STOP 1":

program test
  implicit none
  integer, allocatable :: b
  allocate(b)
  b = 7482
  call checkOptional(.false.,.true., 7482)
  call checkOptional(.true., .true., 7482, b)
  if (b /= 46) error stop 1
contains
  subroutine checkOptional(prsnt, alloc, val, x)
    logical, intent(in) :: prsnt, alloc
    integer, allocatable, optional :: x
    integer, intent(in) :: val
    if (present(x)) then
      if (allocated(x) .neqv. alloc) error stop 2
    end if
    if (present(x)) then
      if (allocated(x)) then
        if (x /= val) error stop 3
      end if
    end if
    if (present(x)) then
      x = 46
    end if
  end subroutine checkOptional
end program test


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
  2010-07-13 17:32 ` [Bug fortran/43665] INTENT(IN) etc. optimization of " burnus at gcc dot gnu dot org
@ 2010-07-20 15:06 ` burnus at gcc dot gnu dot org
  2010-07-20 15:26 ` burnus at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-20 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2010-07-20 15:06 -------
Created an attachment (id=21265)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21265&action=view)
Draft patch for external/user procs with INTENT (mostly OK, but breaks existing
test)

The attached patch mostly works, except for
gfortran.dg/allocatable_scalar_4.f90.

The latter file works fine with -O1 but with -O2 it crashes. At -O1 with
-fdump-tree-original, essentially only one "if" is optimized away:

  b = 7482
  call checkOptional(.false.,.true., 7482)
  if (b /= 7482) call abort() ! <<<< This line is removed for -O1
  call checkOptional(.true., .true., 7482, b)

I could not see anything suspicious for -O{2,1} -fdump-tree-optimized; one
should check -fdump-tree-optimized-all. I somehow have the feeling that some
other DECL is wrong. Cf. PR 44945 for another manifestation of DECL problems
(though there for derived types).

Note: Using -fwhole-file does not help.


-- 


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


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

* [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments
  2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
@ 2010-07-13 17:32 ` burnus at gcc dot gnu dot org
  2010-07-20 15:06 ` burnus at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-13 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2010-07-13 17:32 -------
Main library calls are done.

TODO:
- Intrinsic calls such as "call ctime()" which do not have a function
declaration
- Nonintrinsic functions with non-pointer INTENT(IN/OUT); handle also
(non)clobber [target/pointer ...]
- I/O transfer: Split somehow to make it possible to distinguish READ from
WRITE.
- Possibly, handle somehow unused arguments / not-explicitly given INTENT(in)s 
by saving this information


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Optimization of libgfortran |INTENT(IN) etc. optimization
                   |calls: function annotations |of calls: function
                   |for noclobber/noescape      |annotations for
                   |arguments                   |noclobber/noescape arguments


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


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

end of thread, other threads:[~2013-06-25  9:02 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43665-4@http.gcc.gnu.org/bugzilla/>
2010-10-16 16:06 ` [Bug fortran/43665] INTENT(IN) etc. optimization of calls: function annotations for noclobber/noescape arguments tkoenig at gcc dot gnu.org
2012-06-29 17:32 ` mikael at gcc dot gnu.org
2013-06-25  9:02 ` dominiq at lps dot ens.fr
2010-04-06 13:30 [Bug fortran/43665] New: Optimization of libgfortran " burnus at gcc dot gnu dot org
2010-07-13 17:32 ` [Bug fortran/43665] INTENT(IN) etc. optimization of " burnus at gcc dot gnu dot org
2010-07-20 15:06 ` burnus at gcc dot gnu dot org
2010-07-20 15:26 ` burnus at gcc dot gnu dot org
2010-07-20 15:58 ` burnus at gcc dot gnu dot org
2010-07-20 16:01 ` rguenth at gcc dot gnu dot org
2010-07-20 16:12 ` burnus at gcc dot gnu dot org
2010-07-21  8:09 ` rguenther at suse dot de
2010-07-21  8:27 ` jamborm at gcc dot gnu dot org
2010-07-22 15:36 ` burnus at gcc dot gnu dot org
2010-09-06 14:14 ` jamborm at gcc dot gnu dot org
2010-09-06 18:26 ` jamborm at gcc dot gnu dot org
2010-09-06 18:44 ` burnus at gcc dot gnu dot org
2010-09-07 17:01 ` jamborm at gcc dot gnu dot org
2010-09-08  6:25 ` burnus at gcc dot gnu dot org
2010-09-09  8:43 ` burnus at gcc dot gnu dot org
2010-09-10 12:09 ` burnus at gcc dot gnu dot org
2010-09-10 12:12 ` burnus at gcc dot gnu dot org
2010-09-11 15:13 ` dominiq at lps dot ens dot fr
2010-09-12  9:32 ` burnus at gcc dot gnu dot org
2010-09-12 10:14 ` dominiq at lps dot ens dot fr
2010-09-16 21:30 ` burnus 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).