[PATCH] D141020: [X86][ABI] Clobber %RAX for preserve_allcc and preserve_mostcc CCs
Anton Bikineev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 16:44:59 PST 2023
AntonBikineev created this revision.
AntonBikineev added reviewers: pengfei, ributzka.
Herald added subscribers: jdoerfert, hiraditya, kristof.beyls.
Herald added a project: All.
AntonBikineev requested review of this revision.
Herald added a project: LLVM.
Currently, both calling conventions preserve %RAX. This breaks in this trivial case:
define i32 @bar() {
%1 = call preserve_mostcc i32 @foo()
ret i32 %1
}
define preserve_mostcc i32 @foo() {
ret i32 2
; preserve_mostcc will restore %rax, whatever it was before the call.
}
This contradicts the current documentation (preserve_allcc "behaves
identical to the C calling conventions on how arguments and return
values are passed") and also breaks `[[clang::preserve_most]]`.
This is not a problem for AArch64, where X0-X7 are not part of `CSR_AArch64_RT_MostRegs`.
Juergen, can you please take a look, since you added the CCs originally?
Phoebe, I added you as a reviewer as well, since you touched the X86 CC code recently :)
Thanks!
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141020
Files:
llvm/docs/LangRef.rst
llvm/lib/Target/X86/X86CallingConv.td
llvm/test/CodeGen/X86/ipra-reg-usage.ll
llvm/test/CodeGen/X86/machine-copy-prop.mir
llvm/test/CodeGen/X86/preserve_allcc64.ll
llvm/test/CodeGen/X86/preserve_mostcc64.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141020.486426.patch
Type: text/x-patch
Size: 13129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230105/5dc611fc/attachment.bin>
More information about the llvm-commits
mailing list