sret unnecessarily blocks tail calls on X86
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```llvm
%"string" = type { i64, i64, ptr }
define void @string_ctor(ptr sret(%"string") %agg.result) {
tail call void @func(ptr %agg.result)
ret void
}
declare dso_local void @func(ptr)
```
Currently causes a `call func` on X86, even though it should be perfectly safe to tail-call AFAICT. For some reason the `sret` breaks the tail call.
This has been reduced from libc++'s `string` implementation.
Contributor guide
Research direction
Start by reproducing the provided LLVM IR on X86 and inspect the tail-call lowering path for functions with an sret parameter. Done means the generated X86 code uses a tail call to func while preserving correct sret behavior, with a regression test covering the reduced case.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100