diff options
author | Hans Wennborg <hans@chromium.org> | 2023-01-28 16:38:15 +0100 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2023-01-28 16:38:15 +0100 |
commit | faac9f215962982bdbc613e15715822568204203 (patch) | |
tree | db44e2ad7bb9d564b4f8083628111912975531cc /clang/lib/Basic/SourceManager.cpp | |
parent | 3821391847c4613d21295a53dcab30e6f92fe94c (diff) | |
download | llvm-faac9f215962982bdbc613e15715822568204203.zip llvm-faac9f215962982bdbc613e15715822568204203.tar.gz llvm-faac9f215962982bdbc613e15715822568204203.tar.bz2 |
Revert "[X86][ABI] Don't preserve return regs for preserve_all/preserve_most CCs"
This caused Chromium to crash, see comment on the code review.
> Currently both calling conventions preserve registers that are used to
> store a return value. This causes the returned value to be lost:
>
> 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 change makes CSRs be preserved iff they are not used to store a
> return value (e.g. %rax for scalars, {%rax:%rdx} for __int128, %xmm0
> for double). For void functions no additional registers are
> preserved, i.e. the behaviour is backward compatible with existing
> code.
>
> Differential Revision: https://reviews.llvm.org/D141020
This reverts commit 0276fa89d7a4dbe73105c9148f947716b3d8f17f.
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions