public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111402] New: Loop distribution fail to optimize memmove for multiple consecutive moves within a loop
@ 2023-09-13  9:47 crazylht at gmail dot com
  2023-09-13 11:40 ` [Bug middle-end/111402] " rguenth at gcc dot gnu.org
  2023-09-14  1:16 ` [Bug tree-optimization/111402] " crazylht at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2023-09-13  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111402
           Summary: Loop distribution fail to optimize memmove for
                    multiple consecutive moves within a loop
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

cat test.c

typedef long long v4di __attribute__((vector_size(32)));

void
foo (v4di* __restrict a, v4di *b, int n)
{
  for (int i = 0; i != n; i++)
    a[i] = b[i];
}

void
foo1 (v4di* __restrict a, v4di *b, int n)
{
  for (int i = 0; i != n; i+=2)
    {
    a[i] = b[i];
    a[i+1] = b[i+1];   
    }
}


gcc -O2 -S test.c

GCC can optimize loop in foo to memmove, but not for loop in foo1.
This is from PR111354

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

* [Bug middle-end/111402] Loop distribution fail to optimize memmove for multiple consecutive moves within a loop
  2023-09-13  9:47 [Bug middle-end/111402] New: Loop distribution fail to optimize memmove for multiple consecutive moves within a loop crazylht at gmail dot com
@ 2023-09-13 11:40 ` rguenth at gcc dot gnu.org
  2023-09-14  1:16 ` [Bug tree-optimization/111402] " crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-13 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-09-13
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think we have a duplicate bugreport for this.  Confirmed.

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

* [Bug tree-optimization/111402] Loop distribution fail to optimize memmove for multiple consecutive moves within a loop
  2023-09-13  9:47 [Bug middle-end/111402] New: Loop distribution fail to optimize memmove for multiple consecutive moves within a loop crazylht at gmail dot com
  2023-09-13 11:40 ` [Bug middle-end/111402] " rguenth at gcc dot gnu.org
@ 2023-09-14  1:16 ` crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2023-09-14  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
Adjust code in foo1, use < n instead of != n, the issue remains.

void
foo1 (v4di* __restrict a, v4di *b, int n)
{
  for (int i = 0; i < n; i+=2)
    {
    a[i] = b[i];
    a[i+1] = b[i+1];   
    }
}

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

end of thread, other threads:[~2023-09-14  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13  9:47 [Bug middle-end/111402] New: Loop distribution fail to optimize memmove for multiple consecutive moves within a loop crazylht at gmail dot com
2023-09-13 11:40 ` [Bug middle-end/111402] " rguenth at gcc dot gnu.org
2023-09-14  1:16 ` [Bug tree-optimization/111402] " crazylht at gmail dot com

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).