[PATCH] D48047: [AMDGPU] findMaskOperands() - prevent hitting Assertion `isReg() && "Wrong MachineOperand accessor"'
Mark Searles via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 13:22:22 PDT 2018
msearles updated this revision to Diff 150825.
msearles added a comment.
Added a test
https://reviews.llvm.org/D48047
Files:
lib/Target/AMDGPU/SILowerControlFlow.cpp
test/CodeGen/AMDGPU/si-lower-control-flow.mir
Index: test/CodeGen/AMDGPU/si-lower-control-flow.mir
===================================================================
--- /dev/null
+++ test/CodeGen/AMDGPU/si-lower-control-flow.mir
@@ -0,0 +1,24 @@
+# REQUIRES: asserts
+# RUN: llc -mtriple=amdgcn-amd-amdhsa-amdgizcl -run-pass=si-lower-control-flow -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GCN %s
+
+# Check that assert is not triggered
+# GCN-LABEL: name: si-lower-control-flow{{$}}
+# GCN-CHECK: S_LOAD_DWORD_IMM
+
+--- |
+
+ define amdgpu_kernel void @si-lower-control-flow() {
+ ret void
+ }
+
+...
+---
+name: si-lower-control-flow
+body: |
+ bb.0:
+ %0:sgpr_64 = COPY $sgpr4_sgpr5
+ %1:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %0, 16, 0
+ %2:sreg_32_xm0 = S_AND_B32 %1, 255, implicit-def $scc
+ %3:sreg_32_xm0 = S_AND_B32 65535, %2, implicit-def $scc
+ S_ENDPGM
+...
Index: lib/Target/AMDGPU/SILowerControlFlow.cpp
===================================================================
--- lib/Target/AMDGPU/SILowerControlFlow.cpp
+++ lib/Target/AMDGPU/SILowerControlFlow.cpp
@@ -453,8 +453,8 @@
return;
for (const auto &SrcOp : Def->explicit_operands())
- if (SrcOp.isUse() && (!SrcOp.isReg() ||
- TargetRegisterInfo::isVirtualRegister(SrcOp.getReg()) ||
+ if (SrcOp.isReg() && SrcOp.isUse() &&
+ (TargetRegisterInfo::isVirtualRegister(SrcOp.getReg()) ||
SrcOp.getReg() == AMDGPU::EXEC))
Src.push_back(SrcOp);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48047.150825.patch
Type: text/x-patch
Size: 1453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/f365416c/attachment.bin>
More information about the llvm-commits
mailing list