1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; REQUIRES: amdgpu-registered-target
3 ; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes=openmp-opt < %s | FileCheck %s
5 define internal void @outlined0() {
6 ; CHECK: Function Attrs: nounwind
7 ; CHECK-LABEL: define {{[^@]+}}@outlined0
8 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
10 ; CHECK-NEXT: call void @func() #[[ATTR1:[0-9]+]]
11 ; CHECK-NEXT: [[I:%.*]] = call i32 @__kmpc_get_hardware_num_threads_in_block() #[[ATTR0]]
12 ; CHECK-NEXT: ret void
16 %i = call i32 @__kmpc_get_hardware_num_threads_in_block()
20 define internal void @func() {
21 ; CHECK: Function Attrs: nosync nounwind
22 ; CHECK-LABEL: define {{[^@]+}}@func
23 ; CHECK-SAME: () #[[ATTR1]] {
25 ; CHECK-NEXT: [[I:%.*]] = load ptr, ptr null, align 4294967296
26 ; CHECK-NEXT: store i64 0, ptr [[I]], align 8
27 ; CHECK-NEXT: ret void
30 %i = load ptr, ptr addrspacecast (ptr addrspace(5) null to ptr), align 4294967296
31 store i64 0, ptr %i, align 8
35 define internal void @outlined1() {
36 ; CHECK: Function Attrs: nosync nounwind
37 ; CHECK-LABEL: define {{[^@]+}}@outlined1
38 ; CHECK-SAME: () #[[ATTR1]] {
40 ; CHECK-NEXT: br label [[BB2:%.*]]
42 ; CHECK-NEXT: ret void
44 ; CHECK-NEXT: unreachable
46 ; CHECK-NEXT: call void @__kmpc_free_shared(ptr null, i64 0) #[[ATTR0]]
47 ; CHECK-NEXT: br label [[COMMON_RET:%.*]]
50 %i = icmp sle i32 1, 0
51 br i1 %i, label %bb1, label %bb2
53 common.ret: ; preds = %bb2, %bb1
61 call void @__kmpc_free_shared(ptr null, i64 0)
66 ; CHECK-LABEL: define {{[^@]+}}@user() {
67 ; CHECK-NEXT: call void @outlined0() #[[ATTR0]]
68 ; CHECK-NEXT: call void @outlined1() #[[ATTR1]]
69 ; CHECK-NEXT: ret void
71 call void @outlined0()
72 call void @outlined1()
76 declare i32 @__kmpc_get_hardware_num_threads_in_block()
77 declare void @__kmpc_free_shared(ptr, i64)
79 !llvm.module.flags = !{!0, !1}
81 !0 = !{i32 7, !"openmp", i32 50}
82 !1 = !{i32 7, !"openmp-device", i32 50}
84 ; CHECK: attributes #[[ATTR0]] = { nounwind }
85 ; CHECK: attributes #[[ATTR1]] = { nosync nounwind }
87 ; CHECK: [[META0:![0-9]+]] = !{i32 7, !"openmp", i32 50}
88 ; CHECK: [[META1:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}