https://godbolt.org/z/frjhqMKqc for an example. Removal of allocations due to empty `__cxa_atexit` destructor calls is done by the following globalopt pass. This pass currently does not look for `atexit` handlers generated for platforms that do not use `__cxa_atexit`. By default Win32 and AIX use `atexit`. I don't see an easy way to only remove `atexit` calls that the compiler generated without looking at the generated mangled name of the atexit handler that is being registered. However we can easily remove all `atexit` calls that register empty handlers since it is trivial to ensure the removed call still returns `0` which is the value for success.
94 KiB
94 KiB