[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 03:52:17 PDT 2019
tpr created this revision.
Herald added subscribers: llvm-commits, t-tye, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl, arsenm.
Herald added a project: LLVM.
tpr added a reviewer: arsenm.
That change (r363670) could leave a copy from vgpr to sgpr. Fixed.
Change-Id: I00c3fe6fda2e8e1e36f53195b881b1449c777ea4
Repository:
rL LLVM
https://reviews.llvm.org/D66133
Files:
lib/Target/AMDGPU/SIFoldOperands.cpp
test/CodeGen/AMDGPU/fold-readlane.mir
Index: test/CodeGen/AMDGPU/fold-readlane.mir
===================================================================
--- test/CodeGen/AMDGPU/fold-readlane.mir
+++ 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: lib/Target/AMDGPU/SIFoldOperands.cpp
===================================================================
--- lib/Target/AMDGPU/SIFoldOperands.cpp
+++ 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.214800.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190813/1ea31319/attachment.bin>
More information about the llvm-commits
mailing list