[Bug target/104529] [12 Regression] inefficient codegen around new/delete
tnfchris at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 14 19:07:00 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104529
Tamar Christina <tnfchris at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[missed optimization] |[12 Regression] inefficient
|inefficient codegen around |codegen around new/delete
|new/delete |
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |---
--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
I'm re-opening because I don't think it has anything to do with #94294
This is a GCC 12 regression.
In GCC 11 we generated in the mid-end
<bb 2> [local count: 536870913]:
_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);
return 56;
and in GCC 12 we now generate
<bb 2> [local count: 536870913]:
MEM <vector(4) unsigned char> [(unsigned char *)&D.24688] = { 255, 0, 0, 0 };
MEM <vector(2) unsigned char> [(unsigned char *)&D.24688 + 4B] = { 0, 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);
return 56;
See https://godbolt.org/z/KKfhxTxnd
Forcing it to keep the stores before the call to new.
More information about the Gcc-bugs
mailing list