[llvm] r368736 - [AMDGPU] Fix to 'Fold readlane from copy of SGPR or imm'
Tim Renouf via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 11:57:55 PDT 2019
Author: tpr
Date: Tue Aug 13 11:57:55 2019
New Revision: 368736
URL: http://llvm.org/viewvc/llvm-project?rev=368736&view=rev
Log:
[AMDGPU] Fix to 'Fold readlane from copy of SGPR or imm'
That change (r363670) could leave a copy from vgpr to sgpr. Fixed.
Differential Revision: https://reviews.llvm.org/D66133
Change-Id: I00c3fe6fda2e8e1e36f53195b881b1449c777ea4
Modified:
llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir
Modified: llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp?rev=368736&r1=368735&r2=368736&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFoldOperands.cpp Tue Aug 13 11:57:55 2019
@@ -676,6 +676,9 @@ void SIFoldOperands::foldOperand(
// =>
// %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;
}
Modified: llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir?rev=368736&r1=368735&r2=368736&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/fold-readlane.mir Tue Aug 13 11:57:55 2019
@@ -15,7 +15,7 @@ body: |
# 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 @@ body: |
# 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
More information about the llvm-commits
mailing list