[PATCH] D149775: [AMDGPU] Reserve SGPR pair when long branches are present
Pierre van Houtryve via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 23:53:25 PDT 2023
Pierre-vh added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/GCNPreRABranchDistance.cpp:2
+//===-- GCNPreRABranchDistance.cpp
+//-----------------------------------------===//
+//
----------------
formatting
================
Comment at: llvm/lib/Target/AMDGPU/GCNPreRABranchDistance.cpp:178-180
+ int64_t DestOffset = BlockInfo[DestBB->getNumber()].Offset;
+ int64_t SrcOffset = getInstrOffset(*Last);
+ int64_t Offset =
----------------
All of those are `unsigned` I think so I would use it here too to be consistent
There is also a use of `uint64_t` somewhere else
================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:1453-1455
+ Register UnusedLowSGPR =
+ TRI->findUnusedRegister(MRI, &AMDGPU::SGPR_64RegClass, MF);
+ FuncInfo->setLongBranchReservedReg(UnusedLowSGPR);
----------------
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?
================
Comment at: llvm/test/CodeGen/MIR/AMDGPU/machine-function-info-long-branch-reg.ll:69
+attributes #1 = { nounwind readnone }
\ No newline at end of file
----------------
missing newline
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