59 lines · plain
1; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=attributes --test FileCheck --test-arg %s --test-arg --input-file %s -o %t2; RUN: FileCheck --check-prefixes=CHECK,RESULT %s < %t3 4; Test that invalid reductions aren't produced on convergent functions5; which use convergencectrl bundles6 7; CHECK-LABEL: define float @convergent_intrinsic(float %x, float %y)8; RESULT-SAME: [[CONVERGENT_ONLY:#[0-9]+]] {9define float @convergent_intrinsic(float %x, float %y) #0 {10 %entry.token = call token @llvm.experimental.convergence.entry()11 %val = call float @llvm.amdgcn.readfirstlane.f32(float %x) [ "convergencectrl"(token %entry.token) ]12 ret float %val13}14 15; CHECK-LABEL: define float @convergent_callsite(float %x, float %y)16; RESULT-SAME: [[CONVERGENT_ONLY]] {17; RESULT: call float @extern.func(float %x, float %y) [[CONVERGENT_ONLY]]18define float @convergent_callsite(float %x, float %y) #0 {19 %entry.token = call token @llvm.experimental.convergence.entry()20 %val = call float @extern.func(float %x, float %y) #0 [ "convergencectrl"(token %entry.token) ]21 ret float %val22}23 24; CHECK-LABEL: define float @convergent_declaration(float %x, float %y)25; RESULT-SAME: [[CONVERGENT_ONLY]] {26define float @convergent_declaration(float %x, float %y) #0 {27 %entry.token = call token @llvm.experimental.convergence.entry()28 %val = call float @convergent.extern.func(float %x, float %y) [ "convergencectrl"(token %entry.token) ]29 ret float %val30}31 32; CHECK-LABEL: define float @convergent_func_no_convergent_intrinsics(float %x, float %y)33; RESULT-SAME: [[CONVERGENT_ONLY]] {34define float @convergent_func_no_convergent_intrinsics(float %x, float %y) #0 {35 %val = call float @extern.func(float %x, float %y)36 ret float %val37}38 39; CHECK-LABEL: define float @convergent_func_no_convergent_bundles(float %x, float %y)40; RESULT-SAME: [[CONVERGENT_ONLY]] {41define float @convergent_func_no_convergent_bundles(float %x, float %y) #0 {42 %entry.token = call token @llvm.experimental.convergence.entry()43 %val = call float @extern.func(float %x, float %y)44 ret float %val45}46 47; CHECK-LABEL: declare float @convergent.extern.func(float, float)48; RESULT-SAME: [[CONVERGENT_ONLY]]{{$}}49declare float @convergent.extern.func(float, float) #050declare float @extern.func(float, float)51declare float @llvm.amdgcn.readfirstlane.f32(float) #152declare token @llvm.experimental.convergence.entry() #253 54; RESULT: attributes [[CONVERGENT_ONLY]] = { convergent }55 56attributes #0 = { convergent nounwind }57attributes #1 = { convergent nocallback nofree nounwind willreturn memory(none) }58attributes #2 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }59