In working on generating llvm IR from a different language frontend,
I am looking at clang-produced IR. When a C function returns a
large struct, I see it gets encoded as a function returning void,
with an added, leftmost parameter, which is the address of a result
area, passed by the caller.
The clang-generated code for the return statement in the function
copies the result twice, once from an alloca for an explicitly
declared (in the C code) local variable to an internally generated
alloca, then again to the result area passed by the caller.
Is this necessary? optional? optimized out later? It would be
easier for me to leave out the extra alloca and copy, if that
is workable IR code.