[llvm] r330585 - AMDGPU: Fix a corner case crash in SIOptimizeExecMasking
Nicolai Haehnle via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 23 06:05:51 PDT 2018
Author: nha
Date: Mon Apr 23 06:05:50 2018
New Revision: 330585
URL: http://llvm.org/viewvc/llvm-project?rev=330585&view=rev
Log:
AMDGPU: Fix a corner case crash in SIOptimizeExecMasking
Summary:
See the new test case; this is really unlikely to happen with real code,
but I ran into this while attempting to bugpoint-reduce a different issue.
Change-Id: I9ade1dc1aa8fd9c4d9fc83661d7b80e310b5c4a6
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D45885
Modified:
llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll
Modified: llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp?rev=330585&r1=330584&r2=330585&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp Mon Apr 23 06:05:50 2018
@@ -76,7 +76,7 @@ static unsigned isCopyToExec(const Machi
case AMDGPU::COPY:
case AMDGPU::S_MOV_B64: {
const MachineOperand &Dst = MI.getOperand(0);
- if (Dst.isReg() && Dst.getReg() == AMDGPU::EXEC)
+ if (Dst.isReg() && Dst.getReg() == AMDGPU::EXEC && MI.getOperand(1).isReg())
return MI.getOperand(1).getReg();
break;
}
Modified: llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll?rev=330585&r1=330584&r2=330585&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll Mon Apr 23 06:05:50 2018
@@ -74,6 +74,15 @@ main_body:
ret float %f
}
+; GCN-LABEL: {{^}}init_unreachable:
+;
+; This used to crash.
+define amdgpu_ps void @init_unreachable() {
+main_body:
+ call void @llvm.amdgcn.init.exec(i64 -1)
+ unreachable
+}
+
declare void @llvm.amdgcn.init.exec(i64) #1
declare void @llvm.amdgcn.init.exec.from.input(i32, i32) #1
More information about the llvm-commits
mailing list