public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
@ 2013-03-29  9:47 ` Joost.VandeVondele at mat dot ethz.ch
  2013-03-29 22:19 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-03-29  9:47 UTC (permalink / raw)
  To: gcc-bugs


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

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-11-01 16:21:21         |2013-03-29
                 CC|                            |Joost.VandeVondele at mat
                   |                            |dot ethz.ch
             Blocks|                            |38654

--- Comment #14 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 2013-03-29 09:46:53 UTC ---
The code in comment #0 is actually a frontend optimization, PR38654. 

Noteworthy that the optimizers (ipa-cp plus others) do the right thing for the
tester in comment #1 at -O3 (but can't do this in the general case).


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

* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
  2013-03-29  9:47 ` [Bug fortran/41137] inefficient zeroing of an array Joost.VandeVondele at mat dot ethz.ch
@ 2013-03-29 22:19 ` tkoenig at gcc dot gnu.org
  2013-03-29 22:39 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-03-29 22:19 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #15 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-03-29 22:19:05 UTC ---
The patch from comment#12 causes memory failure of the
following code:


module zero
  implicit none
contains
  subroutine foo(a)
    real, contiguous :: a(:,:)
    a(:,:) = 0
  end subroutine foo
end module zero

program main
  use zero
  implicit none
  real, dimension(5,5) :: a
  a = 1.
  call foo(a(1:5:2,1:5:2))
  write (*,'(5F12.5)') a
end program main

which is a bit strange.


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

* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
  2013-03-29  9:47 ` [Bug fortran/41137] inefficient zeroing of an array Joost.VandeVondele at mat dot ethz.ch
  2013-03-29 22:19 ` tkoenig at gcc dot gnu.org
@ 2013-03-29 22:39 ` burnus at gcc dot gnu.org
  2014-05-01 12:16 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-29 22:39 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #16 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-29 22:38:58 UTC ---
Possible off-topic remark - or hitting right on the nail: Looking at
  a(:,:,:,:)=0.0
and
  a(5:) = 0.0
I wonder whether it couldn't be handled via RANGE_REF, e.g.
  RANGE_REF(a,5,...) = { };
should work if I am not mistaken. Currently, we only do "a = 0.0" -> "a = {};".

See ARRAY_RANGE_REF in trans-expr.c's class_array_data_assign
(gfc_index_zero_node is the offset) for the usage; see also GCC internal manual
and Ada.


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

* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-03-29 22:39 ` burnus at gcc dot gnu.org
@ 2014-05-01 12:16 ` dominiq at lps dot ens.fr
  2014-05-01 12:35 ` Joost.VandeVondele at mat dot ethz.ch
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-01 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.4, 4.7.3, 4.8.2, 4.9.0
      Known to fail|                            |4.5.4

--- Comment #17 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With -O3, I get the same timings for the test in comment 1 since gcc 4.6.4.
Could this PR be closed as FIXED or did I miss something in the discussion?


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

* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-05-01 12:16 ` dominiq at lps dot ens.fr
@ 2014-05-01 12:35 ` Joost.VandeVondele at mat dot ethz.ch
  2014-05-01 17:00 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-05-01 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
(In reply to Dominique d'Humieres from comment #17)
> With -O3, I get the same timings for the test in comment 1 since gcc 4.6.4.
> Could this PR be closed as FIXED or did I miss something in the discussion?

However, the difference remains if the subroutines would be in separate files
(comment #14), in fact, with '-O3 -fno-ipa-cp -fno-inline' the timings remain
poor:

> ./a.out
  0.156975999    
  0.655900002    

I think the issue is that the frontend could/should generate better code for
this.


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

* [Bug fortran/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-05-01 12:35 ` Joost.VandeVondele at mat dot ethz.ch
@ 2014-05-01 17:00 ` tkoenig at gcc dot gnu.org
  2021-12-26  5:51 ` [Bug tree-optimization/41137] " pinskia at gcc dot gnu.org
  2021-12-26  5:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-05-01 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Also see PR 55858.


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

* [Bug tree-optimization/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-05-01 17:00 ` tkoenig at gcc dot gnu.org
@ 2021-12-26  5:51 ` pinskia at gcc dot gnu.org
  2021-12-26  5:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-26  5:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41137

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.0
          Component|fortran                     |tree-optimization
             Status|WAITING                     |RESOLVED

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed:
  <bb 6> [local count: 118111600]:
  # ivtmp.19_52 = PHI <0(5), ivtmp.19_49(6)>
  # ivtmp.23_7 = PHI <_66(5), ivtmp.23_29(6)>
  _37 = (real(kind=4) *) ivtmp.23_7;
  __builtin_memset (_37, 0, _46);
  ivtmp.19_49 = ivtmp.19_52 + 1;
  ivtmp.23_29 = ivtmp.23_7 + _13;
  if (ivtmp.19_49 == _76)
    goto <bb 7>; [12.36%]
  else
    goto <bb 6>; [87.64%]

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

* [Bug tree-optimization/41137] inefficient zeroing of an array
       [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-12-26  5:51 ` [Bug tree-optimization/41137] " pinskia at gcc dot gnu.org
@ 2021-12-26  5:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-26  5:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41137

--- Comment #22 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this is even at -O2 for GCC 10 and above.

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

end of thread, other threads:[~2021-12-26  5:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
2013-03-29  9:47 ` [Bug fortran/41137] inefficient zeroing of an array Joost.VandeVondele at mat dot ethz.ch
2013-03-29 22:19 ` tkoenig at gcc dot gnu.org
2013-03-29 22:39 ` burnus at gcc dot gnu.org
2014-05-01 12:16 ` dominiq at lps dot ens.fr
2014-05-01 12:35 ` Joost.VandeVondele at mat dot ethz.ch
2014-05-01 17:00 ` tkoenig at gcc dot gnu.org
2021-12-26  5:51 ` [Bug tree-optimization/41137] " pinskia at gcc dot gnu.org
2021-12-26  5:51 ` 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).