https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84411
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |19661 Status|UNCONFIRMED |NEW Last reconfirmed| |2024-03-16 Ever confirmed|0 |1 CC| |pinskia at gcc dot gnu.org --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This depends on PR 19661. But then we still need to remove: <bb 2> [local count: 1073741824]: _1 = __atomic_load_1 (&_ZGVZ8get_basevE1d, 2); if (_1 == 0) goto <bb 4>; [33.00%] else goto <bb 3>; [67.00%] <bb 3> [local count: 956811341]: goto <bb 6>; [100.00%] <bb 4> [local count: 354334800]: _2 = __cxa_guard_acquire (&_ZGVZ8get_basevE1d); if (_2 != 0) goto <bb 5>; [33.00%] else goto <bb 3>; [67.00%] <bb 5> [local count: 116930483]: __cxa_guard_release (&_ZGVZ8get_basevE1d); Note clang/LLVM does not remove the use of the guard here either, even though it does remove the __cxa_atexit. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19661 [Bug 19661] unnecessary atexit calls emitted for static objects with empty destructors