[PATCH] D63765: [AMDGPU] Fix Livereg computation during epilogue insertion

Christudasan Devadasan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 06:27:24 PDT 2019


cdevadas created this revision.
cdevadas added a reviewer: arsenm.
Herald added subscribers: llvm-commits, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

The LivePhysRegs calculated in order to find a scratch register in the epilogue code wrongly uses 'LiveIns'. Instead, it should use the 'Liveout' sets.
For the liveness, also considering the operands of the terminator (return) instruction which is the insertion point for the scratch-exec-copy instruction.


Repository:
  rL LLVM

https://reviews.llvm.org/D63765

Files:
  lib/Target/AMDGPU/SIFrameLowering.cpp
  test/CodeGen/AMDGPU/callee-special-input-sgprs.ll


Index: test/CodeGen/AMDGPU/callee-special-input-sgprs.ll
===================================================================
--- test/CodeGen/AMDGPU/callee-special-input-sgprs.ll
+++ test/CodeGen/AMDGPU/callee-special-input-sgprs.ll
@@ -485,7 +485,6 @@
 ; GCN-NOT: s11
 ; GCN-NOT: s12
 ; GCN-NOT: s13
-; GCN-NOT: s[6:7]
 ; GCN-NOT: s[8:9]
 ; GCN-NOT: s[10:11]
 ; GCN-NOT: s[12:13]
Index: lib/Target/AMDGPU/SIFrameLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIFrameLowering.cpp
+++ lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -681,7 +681,8 @@
     if (ScratchExecCopy == AMDGPU::NoRegister) {
       // See emitPrologue
       LivePhysRegs LiveRegs(*ST.getRegisterInfo());
-      LiveRegs.addLiveIns(MBB);
+      LiveRegs.addLiveOuts(MBB);
+      LiveRegs.stepBackward(*MBBI);
 
       ScratchExecCopy
         = findScratchNonCalleeSaveRegister(MF, LiveRegs,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63765.206424.patch
Type: text/x-patch
Size: 915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190625/bc7d05d0/attachment.bin>


More information about the llvm-commits mailing list