public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55858] New: When scalarizing contiguous whole-arrays, consider folding into a single loop
@ 2013-01-03 12:18 burnus at gcc dot gnu.org
  2024-07-19 19:29 ` [Bug fortran/55858] " anlauf at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-03 12:18 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55858
           Summary: When scalarizing contiguous whole-arrays, consider
                    folding into a single loop
    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


Motivated by http://gcc.gnu.org/ml/fortran/2013-01/msg00015.html

Currently, the scalarizer generates (rank) loops:

  subroutine g(x)
    integer, pointer, intent(in), contiguous :: x(:,:)
    x = 8
  end subroutine g

gives

      S.0 = Dx->dim[1].lbound
      while (1)
        {
          if (S.0 > x->dim[1].ubound) goto L.2;
          {
            integer(kind=8) D.1903;
            integer(kind=8) S.1;

            D.1903 = x->dim[1].stride * S.0 + x->offset;
            S.1 = x->dim[0].lbound;
            while (1)
              {
                if (S.1 > x->dim[0].ubound) goto L.1;
                (*D.1895)[S.1 + D.1903] = 8;
                S.1 = S.1 + 1;
              }
            L.1:;
          }
          S.0 = S.0 + 1;
        }


If one knows that the memory is contiguous (i.e. it is simply contiguous), one
can use a single loop.

Or at least something which allows the ME to fold the two loops into a single
loop, e.g.  "stride[1]" could be replaced by the extent
("ubound[0]-lbound[0]+1"), which allows the ME to deduce that one can fold it
into a single loop. Using "stride", the contiguity information is lost.


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

* [Bug fortran/55858] When scalarizing contiguous whole-arrays, consider folding into a single loop
  2013-01-03 12:18 [Bug fortran/55858] New: When scalarizing contiguous whole-arrays, consider folding into a single loop burnus at gcc dot gnu.org
@ 2024-07-19 19:29 ` anlauf at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-07-19 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=115935
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
See also pr115935 on missed optimizations when zeroing of contiguous
whole arrays that are components of derived types.

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

end of thread, other threads:[~2024-07-19 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 12:18 [Bug fortran/55858] New: When scalarizing contiguous whole-arrays, consider folding into a single loop burnus at gcc dot gnu.org
2024-07-19 19:29 ` [Bug fortran/55858] " anlauf 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).