[llvm] r222020 - R600/SI: Fix verifier error from a branch on IMPLICIT_DEF
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Nov 14 10:43:41 PST 2014
Author: arsenm
Date: Fri Nov 14 12:43:41 2014
New Revision: 222020
URL: http://llvm.org/viewvc/llvm-project?rev=222020&view=rev
Log:
R600/SI: Fix verifier error from a branch on IMPLICIT_DEF
SIILowerI1Copies wasn't correctly handling this case.
Added:
llvm/trunk/test/CodeGen/R600/i1-copy-implicit-def.ll
Removed:
llvm/trunk/test/CodeGen/R600/v-cmp-vreg1-src-error.ll
Modified:
llvm/trunk/lib/Target/R600/SILowerI1Copies.cpp
Modified: llvm/trunk/lib/Target/R600/SILowerI1Copies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SILowerI1Copies.cpp?rev=222020&r1=222019&r2=222020&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SILowerI1Copies.cpp (original)
+++ llvm/trunk/lib/Target/R600/SILowerI1Copies.cpp Fri Nov 14 12:43:41 2014
@@ -109,6 +109,14 @@ bool SILowerI1Copies::runOnMachineFuncti
continue;
}
+ if (MI.getOpcode() == AMDGPU::IMPLICIT_DEF) {
+ unsigned Reg = MI.getOperand(0).getReg();
+ const TargetRegisterClass *RC = MRI.getRegClass(Reg);
+ if (RC == &AMDGPU::VReg_1RegClass)
+ MRI.setRegClass(Reg, &AMDGPU::SReg_64RegClass);
+ continue;
+ }
+
if (MI.getOpcode() != AMDGPU::COPY ||
!TargetRegisterInfo::isVirtualRegister(MI.getOperand(0).getReg()) ||
!TargetRegisterInfo::isVirtualRegister(MI.getOperand(1).getReg()))
Added: llvm/trunk/test/CodeGen/R600/i1-copy-implicit-def.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/i1-copy-implicit-def.ll?rev=222020&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/i1-copy-implicit-def.ll (added)
+++ llvm/trunk/test/CodeGen/R600/i1-copy-implicit-def.ll Fri Nov 14 12:43:41 2014
@@ -0,0 +1,21 @@
+; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
+
+; SILowerI1Copies was not handling IMPLICIT_DEF
+; SI-LABEL: @br_implicit_def
+; SI: BB#0:
+; SI-NEXT: s_and_saveexec_b64
+; SI-NEXT: s_xor_b64
+; SI-NEXT: BB#1:
+define void @br_implicit_def(i32 addrspace(1)* %out, i32 %arg) #0 {
+bb:
+ br i1 undef, label %bb1, label %bb2
+
+bb1:
+ store volatile i32 123, i32 addrspace(1)* %out
+ ret void
+
+bb2:
+ ret void
+}
+
+attributes #0 = { nounwind }
Removed: llvm/trunk/test/CodeGen/R600/v-cmp-vreg1-src-error.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/v-cmp-vreg1-src-error.ll?rev=222019&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/v-cmp-vreg1-src-error.ll (original)
+++ llvm/trunk/test/CodeGen/R600/v-cmp-vreg1-src-error.ll (removed)
@@ -1,22 +0,0 @@
-; XFAIL: *
-; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s
-
-define void @init_data_cost_reduce_0(i32 %arg) #0 {
-bb:
- br i1 undef, label %bb1, label %bb2
-
-bb1: ; preds = %bb
- br label %bb2
-
-bb2: ; preds = %bb1, %bb
- br i1 undef, label %bb3, label %bb4
-
-bb3: ; preds = %bb2
- %tmp = mul i32 undef, %arg
- br label %bb4
-
-bb4: ; preds = %bb3, %bb2
- unreachable
-}
-
-attributes #0 = { nounwind }
More information about the llvm-commits
mailing list