summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/sminmax.ll
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-12-20 18:55:06 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-12-20 18:55:06 +0000
commit4c1e9ec00852aea4758ae5a2d44b72c0674d5e96 (patch)
tree23fe172f86034182619c1d248e1d80e839b496b4 /llvm/test/CodeGen/AMDGPU/sminmax.ll
parent45a540f72fb26fc1cd28325becac78bdacb4a295 (diff)
downloadbcm5719-llvm-4c1e9ec00852aea4758ae5a2d44b72c0674d5e96.tar.gz
bcm5719-llvm-4c1e9ec00852aea4758ae5a2d44b72c0674d5e96.zip
AMDGPU: Don't add same instruction multiple times to worklist
When the instruction is processed the first time, it may be deleted resulting in crashes. While the new test adds the same user to the worklist twice, this particular case doesn't crash but I'm not sure why. llvm-svn: 290191
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/sminmax.ll')
-rw-r--r--llvm/test/CodeGen/AMDGPU/sminmax.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/sminmax.ll b/llvm/test/CodeGen/AMDGPU/sminmax.ll
index 560d5597baa..83465206e06 100644
--- a/llvm/test/CodeGen/AMDGPU/sminmax.ll
+++ b/llvm/test/CodeGen/AMDGPU/sminmax.ll
@@ -32,6 +32,20 @@ define void @v_abs_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind
ret void
}
+; GCN-LABEL: {{^}}v_abs_i32_repeat_user:
+; GCN: v_sub_i32_e32 [[NEG:v[0-9]+]], vcc, 0, [[SRC:v[0-9]+]]
+; GCN: v_max_i32_e32 [[MAX:v[0-9]+]], [[NEG]], [[SRC]]
+; GCN: v_mul_lo_i32 v{{[0-9]+}}, [[MAX]], [[MAX]]
+define void @v_abs_i32_repeat_user(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind {
+ %val = load i32, i32 addrspace(1)* %src, align 4
+ %neg = sub i32 0, %val
+ %cond = icmp sgt i32 %val, %neg
+ %res = select i1 %cond, i32 %val, i32 %neg
+ %mul = mul i32 %res, %res
+ store i32 %mul, i32 addrspace(1)* %out, align 4
+ ret void
+}
+
; FUNC-LABEL: {{^}}s_abs_v2i32:
; GCN: s_abs_i32
; GCN: s_abs_i32
OpenPOWER on IntegriCloud