[PATCH] D15724: AMDGPU/SI: fix scratch resource register allocation on Tonga & Iceland

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 13:23:37 PST 2015


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.

The correct number of available SGPRs needs to be taken into account here.

http://reviews.llvm.org/D15724

Files:
  lib/Target/AMDGPU/SIFrameLowering.cpp

Index: lib/Target/AMDGPU/SIFrameLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIFrameLowering.cpp
+++ lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -121,7 +121,12 @@
     unsigned NumPreloaded = MFI->getNumPreloadedSGPRs() / 4;
     // Skip the last 2 elements because the last one is reserved for VCC, and
     // this is the 2nd to last element already.
-    for (MCPhysReg Reg : getAllSGPR128().drop_back(2).slice(NumPreloaded)) {
+    unsigned Drop = 2;
+
+    if (ST.hasSGPRInitBug())
+      Drop = 8;
+
+    for (MCPhysReg Reg : getAllSGPR128().drop_back(Drop).slice(NumPreloaded)) {
       // Pick the first unallocated one. Make sure we don't clobber the other
       // reserved input we needed.
       if (!MRI.isPhysRegUsed(Reg)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15724.43475.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151222/f257a898/attachment.bin>


More information about the llvm-commits mailing list