https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26388
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #20 from Jan Hubicka <hubicka at gcc dot gnu.org> --- with __builtin_operator_new we could theoretically optimize the initial testcase to empty function, but we don't, since we can not handle the reallocation. _60 = operator new (_59); <bb 9> [local count: 166566348]: _46 = (long unsigned int) _38; _47 = _60 + _46; *_47 = i_56; if (_38 != 0) goto <bb 10>; [41.48%] else goto <bb 11>; [58.52%] <bb 10> [local count: 69091722]: __builtin_memcpy (_60, v$_M_start_73, _46); _51 = _46 + 4; __new_finish_54 = _60 + _51; goto <bb 12>; [100.00%] so here we would need to be first able to handle the chain of memcpy copies and *_47 stores probably in DSE and once we get rid of the stores and memcpy theoretically dce can optimize out the allocation/eh and other noise.