[PATCH] D106449: [amdgpu] Handle the case where there is no scavenged register.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 08:07:17 PDT 2021


hliao created this revision.
hliao added reviewers: arsenm, rampitec.
Herald added subscribers: foad, frasercrmck, kerbowa, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, dylanmckay, qcolombet.
hliao requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay, wdng.
Herald added a project: LLVM.

- When an unconditional branch is expanded into an indirect branch, if there is no scavenged register, an SGPR pair needs spilling to enable the destination PC calculation. In addition, before jumping into the destination, that clobbered SGPR pair need restoring.
- As SGPR cannot be spilled to or restored from memory directly, the spilling/restoring of that SGPR pair reuses the regular SGPR spilling support but without spilling it into memory. As that spilling and restoring points are fully controlled, we only need to spill that SGPR into the temporary VGPR, which needs spilling into its emergency slot.
- The target-specific hook is revised to take additional restore block, where the restoring code is filled. After that, the relaxation will place that restore block directly before the destination block and insert an unconditional branch in any fall-through block into the destination block.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106449

Files:
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/lib/CodeGen/BranchRelaxation.cpp
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  llvm/lib/Target/AMDGPU/SIInstrInfo.h
  llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
  llvm/lib/Target/AMDGPU/SIRegisterInfo.h
  llvm/lib/Target/AVR/AVRInstrInfo.cpp
  llvm/lib/Target/AVR/AVRInstrInfo.h
  llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfo.h
  llvm/test/CodeGen/AMDGPU/branch-relax-spill.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106449.360467.patch
Type: text/x-patch
Size: 47000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/5dada037/attachment.bin>


More information about the llvm-commits mailing list