[libcxx-commits] [libcxx] [libc++] Mark libc++ deallocation helpers as noexcept (PR #110884)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 2 12:06:46 PDT 2024
ldionne wrote:
> What effect does this have on codegen?
Depending on compiler inlining, this might not make a difference or this might improve the codegen a bit by removing the implicit try-catch block that Clang generates around non-noexcept functions called from noexcept functions.
Here's an example using Godbolt: https://godbolt.org/z/47d5P86Kz
<img width="3360" alt="Screenshot 2024-10-02 at 15 04 36" src="https://github.com/user-attachments/assets/1c3dff6b-f34e-4267-b308-25c7675b02a5">
You'll have to zoom in, but on the left you have without my patch, and on the right with my patch. You can see that after my patch, we don't generate a `try-catch` block that calls `__clang_call_terminate` inside `__libcpp_deallocate`. The moment you enable optimizations (even `-O1`), there's no difference anymore.
So this is almost NFC, but the code is more correct this way anyway so we might as well do it.
https://github.com/llvm/llvm-project/pull/110884
More information about the libcxx-commits
mailing list