[PATCH] D43049: AMDGPU: Don't crash when trying to fold implicit operands
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 15:36:52 PST 2018
arsenm created this revision.
arsenm added reviewers: rampitec, kzhuravl, cfang.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng.
https://reviews.llvm.org/D43049
Files:
lib/Target/AMDGPU/SIFoldOperands.cpp
test/CodeGen/AMDGPU/fold-implicit-operand.mir
Index: test/CodeGen/AMDGPU/fold-implicit-operand.mir
===================================================================
--- /dev/null
+++ test/CodeGen/AMDGPU/fold-implicit-operand.mir
@@ -0,0 +1,14 @@
+# RUN: llc -march=amdgcn -run-pass si-fold-operands -verify-machineinstrs -o - %s | FileCheck %s
+---
+# Make sure there is no crash when trying to fold an immediate into an
+# implicit use
+
+# CHECK: %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
+# CHECK-NEXT: S_ENDPGM implicit %0
+name: fold_imm_implicit_operand
+body: |
+ bb.0:
+ %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
+ S_ENDPGM implicit %0
+
+...
Index: lib/Target/AMDGPU/SIFoldOperands.cpp
===================================================================
--- lib/Target/AMDGPU/SIFoldOperands.cpp
+++ lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -345,6 +345,7 @@
// Don't fold into target independent nodes. Target independent opcodes
// don't have defined register classes.
if (UseDesc.isVariadic() ||
+ UseOp.isImplicit() ||
UseDesc.OpInfo[UseOpIdx].RegClass == -1)
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43049.133326.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180207/d0f208b0/attachment.bin>
More information about the llvm-commits
mailing list