Clang IR Compile Bug?

Hello Everyone,

May I ask is there anything different in clang when compiling ir than to when compiling with llc.
In particular it seems to cause some problems with returning floats directly but only if they are over 8 bytes in size.

I added the ir as attachment when compiled on arm-macOS via:

clang trs.ll

It causes this code to not work correctly.

If compiled with llc and then linked with clang it works:

llc -filetype=obj trs.ll -o trs.o
clang trs.o -o trs

I yet have to find out why this happens when using clang directly. If anyone has a guess would be nice to know.
The same problem also happens in the backend which I’m currently helping with to develop here i though don’t know how to fix that as I can’t simply call llc as it’s using the llvm-c api todo all of this.

Link to IL Code => https://1drv.ms/u/s!Atg5BVAOHU2EgaBr2UaRfTgjUsUgHw?e=TmGbo5

Best regards,
Platin21

Ok this seems to be a weird ness that llvm does if the ABI is not happy with doing what one does.
As in if you return something bigger than 4 bytes with default return on aarch64 it seems like it’s not happy an creates trash code because it would expect this code to make a sret instead. Which is understandable still a bit annoying that it doesn’t give any hint that this is wrong.

So all in all it’s just not ABI compliant todo what I did and as such ok to create crap code.

Best regards,
Platin21