[PATCH] D149775: [AMDGPU] Reserve SGPR pair when long branches are present

Corbin Robeck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 10:08:37 PDT 2023


crobeck added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:1453-1455
+    Register UnusedLowSGPR =
+        TRI->findUnusedRegister(MRI, &AMDGPU::SGPR_64RegClass, MF);
+    FuncInfo->setLongBranchReservedReg(UnusedLowSGPR);
----------------
Pierre-vh wrote:
> How does this work? Don't you need to check if `UnusedLowSGPR` returns something? Will it always return the pair we reserved earlier if nothing else is available?
> 
> Would it be worth adding a test with `amdgpu-num-sgpr` to see what happens when 100% of SGPRs are used?
Yes, you're right. I've made the checks more explicit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149775



More information about the llvm-commits mailing list