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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=49872,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=79716
   Last reconfirmed|                            |2025-04-07

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note PR 79716 is about DSE for non-constant len.


The commit which added this to DSE for memset: r7-5965-g7c9560a578a061 .

Here is another testcase which shows the issue on the trunk now:
```
char z[32];
int
foo1(void)
{
char z1[17];
char z2[24];
  __builtin_memset (z1, 0, 17);
  __builtin_memcpy (z, z1, 17);
  __builtin_memset (z2, 0, 24);
  __builtin_memcpy (z+8, z2, 24);
}
```

DSE gets:
```
  MEM <unsigned char[17]> [(char * {ref-all})&z] = {};
  MEM <unsigned char[24]> [(char * {ref-all})&z + 8B] = {};
```

And even tries to do the triming:
  Trimming statement (head = 0, tail = 9): MEM <unsigned char[17]> [(char *
{ref-all})&z] = {};

But does not do the triming. Let me see if I can handle that.

Reply via email to