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

--- Comment #2 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
I don't quite see how this is a CSE problem,

There's only one of each constant and none of them are needed before the call.
unlike in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86892

You don't need the values of your array until you allocate memory for said
array.

x86 has the following sequence in GIMPLE

  _32 = operator new (6);
  MEM <unsigned int> [(char * {ref-all})_32] = 255;
  MEM <unsigned short> [(char * {ref-all})_32 + 4B] = 0;
  operator delete (_32, 6);

which is optimal, you create the object, store the values, and remove it.

AArch64 however has this

  MEM <unsigned int> [(unsigned char *)&D.24688] = 255;
  MEM <unsigned short> [(unsigned char *)&D.24688 + 4B] = 0;
  _34 = operator new (6);
  MEM <unsigned char[6]> [(char * {ref-all})_34] = MEM <unsigned char[6]>
[(char * {ref-all})&D.24688];
  D.24688 ={v} {CLOBBER(eol)};
  operator delete (_34, 6);

which is where the issue comes from. So this has nothing to do with CSE as far
as I can tell.  The GIMPLE is just suboptimal.

Reply via email to