public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/114228] New: memset/memcpy loop not always recognised with -Os
@ 2024-03-04 13:18 denis.campredon at gmail dot com
  2024-03-04 13:32 ` [Bug tree-optimization/114228] [14 Regression] " pinskia at gcc dot gnu.org
  2024-03-04 13:56 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: denis.campredon at gmail dot com @ 2024-03-04 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114228
           Summary: memset/memcpy loop not always recognised with -Os
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.campredon at gmail dot com
  Target Milestone: ---

typedef __SIZE_TYPE__ size_t;
void baz(char *);

void foo( char *__restrict buff, const char*__restrict input)
{
    size_t max = __builtin_strlen (input);
    for(size_t i = 0 ; i < max; ++i)
        buff[i] = 0;

    baz(buff);
}

void bar( char *__restrict buff, const char*__restrict input)
{
    size_t max = __builtin_strlen (input);
    for(size_t i = 0 ; i < max; ++i)
        buff[i] = input[i];

    baz(buff);
}
--------------

The code above, compiled with -Os, the current trunk fails to convert the two
loops into memcpy/memset.

gcc 13.2 is able to convert the loops into a call.

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

* [Bug tree-optimization/114228] [14 Regression] memset/memcpy loop not always recognised with -Os
  2024-03-04 13:18 [Bug rtl-optimization/114228] New: memset/memcpy loop not always recognised with -Os denis.campredon at gmail dot com
@ 2024-03-04 13:32 ` pinskia at gcc dot gnu.org
  2024-03-04 13:56 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-04 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |needs-bisection
   Last reconfirmed|                            |2024-03-04
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |14.0
            Summary|memset/memcpy loop not      |[14 Regression]
                   |always recognised with -Os  |memset/memcpy loop not
                   |                            |always recognised with -Os

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

The IR is the same before coming into ldist .

ldist in 13.2.0 had:
```
ldist creates useful parallel partition:
  0, 1, 2, 3, 4
Applying pattern match.pd:365, generic-match.cc:23462
distribute loop <1> into partitions:
```

But the trunk:
```
ldist asked to generate code for vertex 3
ldist creates useful parallel partition:
  0, 1, 2, 3, 4
Loop 1 not distributed.
```

But no reason why though.

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

* [Bug tree-optimization/114228] [14 Regression] memset/memcpy loop not always recognised with -Os
  2024-03-04 13:18 [Bug rtl-optimization/114228] New: memset/memcpy loop not always recognised with -Os denis.campredon at gmail dot com
  2024-03-04 13:32 ` [Bug tree-optimization/114228] [14 Regression] " pinskia at gcc dot gnu.org
@ 2024-03-04 13:56 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-04 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like this was on purpose, see PR 111583 for more analysis.

Basically if buff/input were either NULL, then this would have been an invalid
transformation.

So invalid.

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

end of thread, other threads:[~2024-03-04 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 13:18 [Bug rtl-optimization/114228] New: memset/memcpy loop not always recognised with -Os denis.campredon at gmail dot com
2024-03-04 13:32 ` [Bug tree-optimization/114228] [14 Regression] " pinskia at gcc dot gnu.org
2024-03-04 13:56 ` 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).