https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80641
--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
With -O3 we now get:
int main ()
{
<bb 2> [local count: 114863531]:
return 0;
}
-O2 offlines destructors which prevents us from optimizing away new()
int main ()
{
void * D.27676;
int * c$_M_finish;
int * __result;
struct vector c;
int _1;
void * _10;
long int _14;
long unsigned int _30;
long unsigned int _31;
int * _40;
int * _50;
<bb 2> [local count: 114863530]:
MEM[(struct _Vector_impl_data *)&c] ={v} {CLOBBER(bob)};
MEM[(struct _Vector_impl_data *)&c]._M_end_of_storage = 0B;
_40 = operator new (16);
<bb 3> [local count: 114863530]:
MEM <uint128_t> [(char * {ref-all})_40] = 0x30000000200000001;
__result_33 = _40 + 16;
c.D.25570._M_impl.D.24881._M_end_of_storage = __result_33;
goto <bb 5>; [100.00%]
<bb 4> [count: 0]:
<L14>:
MEM <vector(2) long unsigned int> [(struct vector *)&c] = { 0, 0 };
std::_Vector_base<int, std::allocator<int> >::~_Vector_base (&c.D.25570);
_10 = __builtin_eh_pointer (9);
__builtin_unwind_resume (_10);
<bb 5> [local count: 339720492]:
# c$_M_finish_32 = PHI <_50(8), __result_33(3)>
_14 = c$_M_finish_32 - _40;
<bb 6> [local count: 1073741824]:
if (_14 != 0)
goto <bb 7>; [94.50%]
else
goto <bb 9>; [5.50%]
<bb 7> [local count: 1014686025]:
_1 = MEM[(value_type &)c$_M_finish_32 + 18446744073709551612];
if (_1 == 0)
goto <bb 8>; [94.50%]
else
goto <bb 9>; [5.50%]
<bb 8> [local count: 958878294]:
_31 = (long unsigned int) _14;
_30 = _31 + 18446744073709551612;
_50 = _40 + _30;
if (c$_M_finish_32 != _50)
goto <bb 5>; [70.00%]
else
goto <bb 6>; [30.00%]
<bb 9> [local count: 114863531]:
MEM <int *> [(struct vector *)&c] = _40;
MEM <int *> [(struct vector *)&c + 8B] = c$_M_finish_32;
std::_Vector_base<int, std::allocator<int> >::~_Vector_base (&c.D.25570);
c ={v} {CLOBBER(eob)};
c ={v} {CLOBBER(eos)};
return 0;
}