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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |99098
           Keywords|                            |missed-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One thing I noticed is we have:
```
  MEM[(struct _Sp_counted_deleter *)&storage].D.29810._vptr._Sp_counted_base =
&MEM <int (*) ()[7]> [(void
*)&_ZTVSt19_Sp_counted_deleterIP1XSt14default_deleteIS0_ESaIvELN9__gnu_cxx12_Lock_policyE2EE
+ 16B];
  MEM[(struct _Impl *)&storage + 16B]._M_ptr = _9;
  __libc_single_threaded.9_40 = __libc_single_threaded;

...
  <bb 7> [local count: 115887544]:
  MEM <vector(2) int> [(int *)&storage + 8B] = { 0, 0 };
  _87 = MEM[(struct _Sp_counted_base *)&storage]._vptr._Sp_counted_base;
  _88 = MEM[(int (*) () *)_87 + 16B];
  PROF_91 = [obj_type_ref] OBJ_TYPE_REF(_88;(struct
_Sp_counted_base)&storage->2B);
  if (PROF_91 == _M_dispose)
    goto <bb 12>; [24.00%]
  else
    goto <bb 8>; [76.00%]

  <bb 8> [local count: 88074534]:
  PROF_93 = [obj_type_ref] OBJ_TYPE_REF(_88;(struct
_Sp_counted_base)&storage->2B);
  if (PROF_93 == _M_dispose)
    goto <bb 9>; [52.63%]
  else
    goto <bb 11>; [47.37%]
```

in optimized but we have 2 cehcks for different _M_dispose here one seems to be
other virtual function that is almost definition not called.


Now on the subject middle-end warnings, maybe the inlined devirtualization
regions we should mark those such not warn for these middle-end warnings
because most likely the code is never reachable.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99098
[Bug 99098] [meta-bug] invalid/missing -Wfree-nonheap-object warnings

Reply via email to