[llvm] r195025 - R600/SI: Fix another case of illegal VGPR->SGPR copy
Tom Stellard
thomas.stellard at amd.com
Mon Nov 18 10:50:15 PST 2013
Author: tstellar
Date: Mon Nov 18 12:50:15 2013
New Revision: 195025
URL: http://llvm.org/viewvc/llvm-project?rev=195025&view=rev
Log:
R600/SI: Fix another case of illegal VGPR->SGPR copy
Modified:
llvm/trunk/lib/Target/R600/SIFixSGPRCopies.cpp
llvm/trunk/test/CodeGen/R600/sgpr-copy.ll
Modified: llvm/trunk/lib/Target/R600/SIFixSGPRCopies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIFixSGPRCopies.cpp?rev=195025&r1=195024&r2=195025&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIFixSGPRCopies.cpp (original)
+++ llvm/trunk/lib/Target/R600/SIFixSGPRCopies.cpp Mon Nov 18 12:50:15 2013
@@ -181,14 +181,13 @@ bool SIFixSGPRCopies::isVGPRToSGPRCopy(c
unsigned SrcReg = Copy.getOperand(1).getReg();
unsigned SrcSubReg = Copy.getOperand(1).getSubReg();
const TargetRegisterClass *DstRC = MRI.getRegClass(DstReg);
+ const TargetRegisterClass *SrcRC;
if (!TargetRegisterInfo::isVirtualRegister(SrcReg) ||
DstRC == &AMDGPU::M0RegRegClass)
return false;
- const TargetRegisterClass *SrcRC = TRI->getSubRegClass(
- MRI.getRegClass(SrcReg), SrcSubReg);
-
+ SrcRC = inferRegClassFromDef(TRI, MRI, SrcReg, SrcSubReg);
return TRI->isSGPRClass(DstRC) &&
!TRI->getCommonSubClass(DstRC, SrcRC);
}
Modified: llvm/trunk/test/CodeGen/R600/sgpr-copy.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/sgpr-copy.ll?rev=195025&r1=195024&r2=195025&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/R600/sgpr-copy.ll (original)
+++ llvm/trunk/test/CodeGen/R600/sgpr-copy.ll Mon Nov 18 12:50:15 2013
@@ -268,3 +268,29 @@ endif:
}
!2 = metadata !{metadata !"const", null, i32 1}
+
+; CHECK-LABEL: @copy1
+; CHECK: BUFFER_LOAD_DWORD
+; CHECK: V_ADD
+; CHECK: S_ENDPGM
+define void @copy1(float addrspace(1)* %out, float addrspace(1)* %in0) {
+entry:
+ %0 = load float addrspace(1)* %in0
+ %1 = fcmp oeq float %0, 0.0
+ br i1 %1, label %if0, label %endif
+
+if0:
+ %2 = bitcast float %0 to i32
+ %3 = fcmp olt float %0, 0.0
+ br i1 %3, label %if1, label %endif
+
+if1:
+ %4 = add i32 %2, 1
+ br label %endif
+
+endif:
+ %5 = phi i32 [ 0, %entry ], [ %2, %if0 ], [ %4, %if1 ]
+ %6 = bitcast i32 %5 to float
+ store float %6, float addrspace(1)* %out
+ ret void
+}
More information about the llvm-commits
mailing list