codegen: implement `sret_union` ABI for pointer-ful types (#55045)
This effectively expands our existing `union` ABI to cover both of these
existing cases:
- `sret` ABI (which can stack-allocate a _single pointer-ful_ type)
- `union` ABI (which can stack-allocate _many pointer-free_ types)
This provides some nice speed-ups for temporary "wrappers":
```julia
const v = Any[]
@noinline maybe_wrapped(i) = (i % 32 != 0) ? Some(v) : nothing
function foo()
count = 0
for i = 1:1_000_000
count += (maybe_wrapped(i) !== nothing) ? 1 : 0
end
return count
end
```
On this PR this gives:
```julia
julia> @btime foo()
1.675 ms (0 allocations: 0 bytes)
968750
```
compared to current master:
```julia
julia> @btime foo()
6.877 ms (968750 allocations: 14.78 MiB)
968750
```
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>