Issue 86738
Summary `va_arg()` code is suboptimal for AArch64 and x86-64
Labels backend:AArch64, backend:X86, missed-optimization
Assignees
Reporter Kmeakin
    https://godbolt.org/z/hE6Maszq1

```c
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

uint32_t get_u32(size_t count, ...) {
    uint32_t ret = 0;
    va_list args;
    va_start(args, count);
    ret = va_arg(args, uint32_t);
 va_end(args);
    
    return ret;
}
```

This simple function to get the first variadic argument to a function compiles to way more instructions for AArch64 and x86-64 under Clang than GCC. Clang generates slightly fewer instructions for RISCV than GCC does though
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to