[llvm] [AMDGPU] Use new CSR cost calculation (PR #219220)

Lukas Sommer via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 01:20:40 PDT 2026


================
@@ -107,9 +107,17 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
   // lanes (not even inactive ones).
   static bool isChainScratchRegister(Register VGPR);
 
-  // Stack access is very expensive. CSRs are also the high registers, and we
-  // want to minimize the number of used registers.
-  unsigned getCSRCost() const override { return 100; }
----------------
sommerlukas wrote:

Right now, other backends (AArch64, RISC-V) still use this hook, so we can't delete entirely. However, there is an ongoing refactoring effort for this API, started by @williamweixiao in https://github.com/llvm/llvm-project/pull/202007. @weiguozhi has started landing other bits of that refactoring effort, e.g., https://github.com/llvm/llvm-project/pull/214857. I've only extracted the AMDGPU-specific parts to unblock some other work. 

As the refactoring progresses, the old API should eventually be deleted entirely.

https://github.com/llvm/llvm-project/pull/219220


More information about the llvm-commits mailing list