[all-commits] [llvm/llvm-project] 5df3dc: [AMDGPU] Fix caller/callee mismatch in SGPR assign...

Shilei Tian via All-commits all-commits at lists.llvm.org
Mon Feb 23 09:23:37 PST 2026


  Branch: refs/heads/users/shiltian/fix-inreg-argument-caller-callee-mismatch
  Home:   https://github.com/llvm/llvm-project
  Commit: 5df3dc3daba7dd225dd5ffe0ef422198ec5bdd56
      https://github.com/llvm/llvm-project/commit/5df3dc3daba7dd225dd5ffe0ef422198ec5bdd56
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2026-02-23 (Mon, 23 Feb 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call.ll
    M llvm/test/CodeGen/AMDGPU/call-args-inreg-bfloat.ll
    M llvm/test/CodeGen/AMDGPU/call-args-inreg-no-sgpr-for-csrspill-xfail.ll
    M llvm/test/CodeGen/AMDGPU/call-args-inreg.ll
    M llvm/test/CodeGen/AMDGPU/cc-inreg-sgpr0-3-mismatch.ll
    M llvm/test/CodeGen/AMDGPU/function-args-inreg.ll
    M llvm/test/CodeGen/AMDGPU/tail-call-inreg-arguments.convergencetokens.ll
    M llvm/test/CodeGen/AMDGPU/tail-call-inreg-arguments.error.ll
    M llvm/test/CodeGen/AMDGPU/tail-call-inreg-arguments.ll

  Log Message:
  -----------
  [AMDGPU] Fix caller/callee mismatch in SGPR assignment for inreg args

On the callee side, `LowerFormalArguments` marks SGPR0-3 as allocated in
`CCState` before running the CC analysis. On the caller side, `LowerCall` (and
GlobalISel's `lowerCall`/`lowerTailCall`) added the scratch resource to
`RegsToPass` without marking it in `CCState`. This caused `CC_AMDGPU_Func` to
treat SGPR0-3 as available on the caller side, assigning user inreg args there,
while the callee skipped them without marking it in `CCState`. This caused
`CC_AMDGPU_Func` to treat SGPR0-3 as available on the caller side, assigning
user inreg args there, while the callee skipped them.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list