public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108863] New: Unrolling could use range information
@ 2023-02-20 20:26 tkoenig at gcc dot gnu.org
  2023-02-20 20:27 ` [Bug tree-optimization/108863] " tkoenig at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-02-20 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108863
           Summary: Unrolling could use range information
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54497
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54497&action=edit
Assembly code generated by test case

Looking a bit more at the code generated for the test code of PR108839.

For the test
$ cat u2.c
void foo(double *const restrict dx, double *dy, double da, long int n)
{
      long int m = n % 4;
      for (unsigned long i = 0; i < m; i++ )
        dy[i] = dy[i] + da * dx[i];
}

a recently-ish trunk gives, with

$ gcc -S -O3  -funroll-all-loops -fno-tree-vectorize u2.c

far too much unrolling for a loop which can only be executed, at
most, four times (see attachment).

The range information about m does not appear to be propagated to
the unroll passes.

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

* [Bug tree-optimization/108863] Unrolling could use range information
  2023-02-20 20:26 [Bug tree-optimization/108863] New: Unrolling could use range information tkoenig at gcc dot gnu.org
@ 2023-02-20 20:27 ` tkoenig at gcc dot gnu.org
  2023-02-20 20:33 ` [Bug rtl-optimization/108863] " pinskia at gcc dot gnu.org
  2023-02-20 21:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-02-20 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization

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

* [Bug rtl-optimization/108863] Unrolling could use range information
  2023-02-20 20:26 [Bug tree-optimization/108863] New: Unrolling could use range information tkoenig at gcc dot gnu.org
  2023-02-20 20:27 ` [Bug tree-optimization/108863] " tkoenig at gcc dot gnu.org
@ 2023-02-20 20:33 ` pinskia at gcc dot gnu.org
  2023-02-20 21:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-20 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |rtl-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #0)
> The range information about m does not appear to be propagated to
> the unroll passes.

Most likely because range information is not propagated at all to rtl level.
In this case even just non-zero bits might be enough...

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

* [Bug rtl-optimization/108863] Unrolling could use range information
  2023-02-20 20:26 [Bug tree-optimization/108863] New: Unrolling could use range information tkoenig at gcc dot gnu.org
  2023-02-20 20:27 ` [Bug tree-optimization/108863] " tkoenig at gcc dot gnu.org
  2023-02-20 20:33 ` [Bug rtl-optimization/108863] " pinskia at gcc dot gnu.org
@ 2023-02-20 21:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-20 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-02-20
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Though maybe the tree level unroller could improve this situtation
such that it just does the unroll here 4 times.

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

end of thread, other threads:[~2023-02-20 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 20:26 [Bug tree-optimization/108863] New: Unrolling could use range information tkoenig at gcc dot gnu.org
2023-02-20 20:27 ` [Bug tree-optimization/108863] " tkoenig at gcc dot gnu.org
2023-02-20 20:33 ` [Bug rtl-optimization/108863] " pinskia at gcc dot gnu.org
2023-02-20 21:09 ` 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).