Passing arguments and returning value of struct or class

Hi all.

I’m new to LLVM and I’m having fun with LLVM.
Recently, I fount that function calls are changed based on the types of return value and arguments.

For example, as following codes, the generated LLVM IRs are efferent from what I expected them would be.

I remember as pointed out by someone else on the mailing list. (Tim, I believe) This is Clang trying to match the platform’s ABI specification



These rules are called "platform ABI". So, clang is emitting the IR to
match the requirements the ABI of a particular platform.

See e.g. 3.2.3 of
for an example of such rules on x86-64 platform (they are different on
other platforms).