1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -codegenprepare %s | FileCheck %s
2
3define internal fastcc void @callee(i32* nocapture %p, i32 %a) #0 {
4  store volatile i32 %a, i32* %p, align 4
5  ret void
6}
7
8; CHECK-LABEL: @func_caller(
9; CHECK: tail call fastcc void @callee(
10; CHECK-NEXT: ret void
11; CHECK: ret void
12define void @func_caller(i32* nocapture %p, i32 %a, i32 %b) #0 {
13entry:
14  %cmp = icmp eq i32 %b, 0
15  br i1 %cmp, label %bb, label %ret
16
17bb:
18  tail call fastcc void @callee(i32* %p, i32 %a)
19  br label %ret
20
21ret:
22  ret void
23}
24
25; CHECK-LABEL: @kernel_caller(
26; CHECK: tail call fastcc void @callee(
27; CHECK-NEXT: br label %ret
28
29; CHECK: ret void
30define amdgpu_kernel void @kernel_caller(i32* nocapture %p, i32 %a, i32 %b) #0 {
31entry:
32  %cmp = icmp eq i32 %b, 0
33  br i1 %cmp, label %bb, label %ret
34
35bb:
36  tail call fastcc void @callee(i32* %p, i32 %a)
37  br label %ret
38
39ret:
40  ret void
41}
42
43attributes #0 = { nounwind }
44