Closed m-lw closed 1 day ago
@llvm/issue-subscribers-backend-x86
Author: None (m-lw)
CC @phoebewang @rnk as author/reviewer for the original changes. It does seem like the original changes maybe should have only applied when we're trying to be compatible with MSVC?
This feels like a GCC bug, but I doubt they will make any change. It would be reasonable to thread isWindowsMSVCEnvironment into the boolean logic that controls whether we update the free register set.
Just to be clear, this is not something specific to GCC 15. The oldest GCC that I have easy access to is 4.1.2 and that also passes the second argument on the stack.
fastcall
is a concept from MSVC. From this point of view, it's GCC's bug that doesn't comply with the prototype, no matter how long it exists.
Some uses of fastcall in the x86 abi no longer match what gcc has always generated on unix. This changed in llvm 16 and is probably the result of the fix for #57737. Possibly this fix should have only applied to MS Windows targets?
E.g. compiling this code with the -O option on FreeBSD 13.3 with clang version 19.0.0git (snapshot from 2024-05-10):
gives this code:
whereas in gcc version 15.0.0 20240630 (experimental) it gives:
Note that the second argument is in
%cl
in clang but is on the stack in gcc.