Issue 76633
Summary [clang] `[[noreturn]]` can result in worse code gen
Labels clang
Assignees
Reporter philnik777
    ```c++
NORETURN void my_abort();

void call_abort() {
 my_abort();
}
```
When `-DNORETURN=`, this results in
```
call_abort():                        # @call_abort()
 jmp     my_abort()@PLT                # TAILCALL
```
When `-DNORETURN=[[noreturn]]`, this results in
```
call_abort(): # @call_abort()
        push    rax
        call my_abort()@PLT
```
([godbolt](https://godbolt.org/z/xfo5zWfM4)), which seems strictly worse than the above version. While this isn't significant performance-wise, a very similar pattern can be observed in libc++ for `__throw_` functions, which results in quite a bit of unnecessary code due to multiple layers of this.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to