public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107372] New: Loop distribution create memcpy between structs with different storage order
@ 2022-10-24  7:48 krebbel at gcc dot gnu.org
  2022-10-24  7:49 ` [Bug tree-optimization/107372] " krebbel at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: krebbel at gcc dot gnu.org @ 2022-10-24  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107372
           Summary: Loop distribution create memcpy between structs with
                    different storage order
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krebbel at gcc dot gnu.org
  Target Milestone: ---

For t.c with "gcc -O3 t.c":

struct L
{
  unsigned int val[256];
} __attribute__((scalar_storage_order ("little-endian")));

struct B
{
  unsigned int val[256];
} __attribute__((scalar_storage_order ("big-endian")));

void
foo (struct L *restrict l, struct B *restrict b)
{
  int i;
  for (i = 0; i < 256; i++)
    l->val[i] = b->val[i];
}


The loop distribution pass currently generates a memcpy although it recognizes
correctly that both sides of the assignment have different storage order:

Analyzing # of iterations of loop 1
  exit condition [255, + , 4294967295] != 0
  bounds on difference of bases: -255 ... -255
  result:
    # of iterations 255, bounded by 255
Creating dr for *b_5(D).val[i_11]
analyze_innermost: t.c:16:23: missed: failed: reverse storage order.

...

void foo (struct L * restrict l, struct B * restrict b)
{
  int i;

  <bb 2> [local count: 10737416]:
  __builtin_memcpy (l_6(D), b_5(D), 1024);
  return;

}

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

end of thread, other threads:[~2024-03-10  0:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  7:48 [Bug tree-optimization/107372] New: Loop distribution create memcpy between structs with different storage order krebbel at gcc dot gnu.org
2022-10-24  7:49 ` [Bug tree-optimization/107372] " krebbel at gcc dot gnu.org
2022-10-24 13:23 ` [Bug tree-optimization/107372] Loop distribution creates " rguenth at gcc dot gnu.org
2024-03-10  0:44 ` pinskia at gcc dot gnu.org
2024-03-10  0:45 ` 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).