[PATCH] D143425: Reland "[X86][ABI] Don't preserve return regs for preserve_all/preserve_most CCs""

Anton Bikineev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 09:27:40 PST 2023


AntonBikineev marked 2 inline comments as done.
AntonBikineev added a comment.

>> The updated revision also contains a slight functional change: for functions with the `sret` parameter (function returning a struct by value) I still preserve `%rax`. The standard SysV CC requires the `sret` (i.e. `%rdi`) be copied into `%rax`, but for the `preserve_*` CCs this is redundant and is not actually used, since it's always the same as the preserved `%rdi`.
>
> I doubt about it, given it is ABI specified. Are there existing callers use `RAX` to access date rather than `rdi`?

For these CCs there shouldn't be any callers expecting `%rax` to change since it's anyway been preserved. In that sense the change doesn't break any existing users that may use `sret` with these CCs.



================
Comment at: llvm/test/CodeGen/X86/dynamic-regmask-preserve-most.ll:1
+; RUN: llc -mtriple=x86_64-apple-darwin -stop-after machine-sink %s -o %t.mir
+; RUN: FileCheck %s < %t.mir
----------------
pengfei wrote:
> Why choose `machine-sink` as the check point?
Hm, I just copied the code from `dynamic-regmask.ll`. I guess we can stop after `finalize-isel` to check CSRs and masks.


================
Comment at: llvm/test/CodeGen/X86/dynamic-regmask-preserve-most.ll:3
+; RUN: FileCheck %s < %t.mir
+; RUN: llc %t.mir -mtriple=x86_64-apple-darwin -run-pass machine-sink
+
----------------
pengfei wrote:
> What's this RUN checking for?
(removed)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143425/new/

https://reviews.llvm.org/D143425



More information about the llvm-commits mailing list