[PATCH] D66133: [AMDGPU] Fix to 'Fold readlane from copy of SGPR or imm'

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 11:57:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368736: [AMDGPU] Fix to 'Fold readlane from copy of SGPR or imm' (authored by tpr, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66133?vs=214800&id=214893#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66133

Files:
  llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
  llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir


Index: llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir
+++ llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir
@@ -15,7 +15,7 @@
 # GCN: %0:vgpr_32 = V_MOV_B32_e32 123, implicit $exec
 # GCN: %1:sreg_32_xm0 = S_MOV_B32 123
 # GCN: %2:vgpr_32 = V_MOV_B32_e32 123, implicit $exec
-# GCN: %3:sreg_32_xm0 = S_MOV_B32 123
+# GCN: %3:sreg_32_xm0 = COPY %1
 
 ---
 name: fold-imm-readfirstlane-readfirstlane
@@ -33,7 +33,7 @@
 # GCN-LABEL: name: fold-copy-readfirstlane{{$}}
 # GCN: %0:sreg_32_xm0 = COPY $sgpr10
 # GCN: %1:vgpr_32 = COPY %0
-# GCN: %2:sreg_32_xm0 = COPY %1
+# GCN: %2:sreg_32_xm0 = COPY %0
 ---
 name: fold-copy-readfirstlane
 tracksRegLiveness: true
Index: llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -676,6 +676,9 @@
         // =>
         // %sgpr1 = COPY %sgpr0
         UseMI->setDesc(TII->get(AMDGPU::COPY));
+        UseMI->getOperand(1).setReg(OpToFold.getReg());
+        UseMI->getOperand(1).setSubReg(OpToFold.getSubReg());
+        UseMI->getOperand(1).setIsKill(false);
         UseMI->RemoveOperand(2); // Remove exec read (or src1 for readlane)
         return;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66133.214893.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190813/726d1cce/attachment.bin>


More information about the llvm-commits mailing list