[all-commits] [llvm/llvm-project] 1fa58c: [AMDGPU] Callee saves for amdgpu_cs_chain[_preserv...

Diana via All-commits all-commits at lists.llvm.org
Tue Nov 7 23:28:29 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fa58c7790ee36591326d3bebcb417b3c4b06e37
      https://github.com/llvm/llvm-project/commit/1fa58c7790ee36591326d3bebcb417b3c4b06e37
  Author: Diana <Diana-Magda.Picus at amd.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUCallingConv.td
    M llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
    M llvm/lib/Target/AMDGPU/SIInstrInfo.h
    M llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.h
    M llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-cc.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-preserve-cc.ll
    A llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain-preserve.mir
    A llvm/test/CodeGen/AMDGPU/pei-amdgpu-cs-chain.mir

  Log Message:
  -----------
  [AMDGPU] Callee saves for amdgpu_cs_chain[_preserve] (#71526)

Teach prolog epilog insertion how to handle functions with the
amdgpu_cs_chain or amdgpu_cs_chain_preserve calling conventions.

For amdgpu_cs_chain functions, we only need to preserve the inactive
lanes of VGPRs above v8, and only in the presence of calls via
@llvm.amdgcn.cs.chain.

For amdgpu_cs_chain_preserve functions, we will also need to preserve
the active lanes for registers above the last argument VGPR. AFAICT
there's no direct way to find out what the last argument VGPR is, so
instead the patch uses the fact that chain calls from
amdgpu_cs_chain_preserve functions can't use more VGPRs than the
caller's VGPR arguments. In other words, it removes the operands of
SI_CS_CHAIN_TC instructions from the list of callee saved registers.

For both calling conventions, registers v0-v7 never need to be saved and
restored, so we should never add them as WWM spills.

Differential Revision: https://reviews.llvm.org/D156412




More information about the All-commits mailing list