|
| 1 | +; Check that invalid reductions aren't introduced by deleting |
| 2 | +; convergencectrl bundles in convergent functions |
| 3 | +; |
| 4 | +; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operand-bundles --test FileCheck --test-arg --check-prefixes=CHECK,INTERESTING --test-arg %s --test-arg --input-file %s -o %t |
| 5 | +; RUN: FileCheck --check-prefixes=CHECK,RESULT %s < %t |
| 6 | + |
| 7 | +; CHECK-LABEL: define float @convergentctrl_one_interesting( |
| 8 | +; INTERESTING: %interesting = call float @convergent.extern.func( |
| 9 | +; RESULT: %entry.token = call token @llvm.experimental.convergence.entry() |
| 10 | +; RESULT: %interesting = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 11 | +; RESULT: %boring = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 12 | +define float @convergentctrl_one_interesting(float %x, float %y) #0 { |
| 13 | + %entry.token = call token @llvm.experimental.convergence.entry() |
| 14 | + %interesting = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 15 | + %boring = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 16 | + %add = fadd float %interesting, %boring |
| 17 | + ret float %add |
| 18 | +} |
| 19 | + |
| 20 | +; In theory we could remove the bundle here, since all convergencectrl |
| 21 | +; in the function will be removed. |
| 22 | + |
| 23 | +; CHECK-LABEL: define float @convergentctrl_can_remove_all( |
| 24 | +; RESULT: %entry.token = call token @llvm.experimental.convergence.entry() |
| 25 | +; RESULT: %val = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 26 | +define float @convergentctrl_can_remove_all(float %x, float %y) #0 { |
| 27 | + %entry.token = call token @llvm.experimental.convergence.entry() |
| 28 | + %val = call float @convergent.extern.func(float %x) [ "convergencectrl"(token %entry.token) ] |
| 29 | + ret float %val |
| 30 | +} |
| 31 | + |
| 32 | +declare float @convergent.extern.func(float) #0 |
| 33 | +declare token @llvm.experimental.convergence.entry() #1 |
| 34 | + |
| 35 | +attributes #0 = { convergent } |
| 36 | +attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) } |
0 commit comments