[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / Transforms / OpenMP / spmdization_assumes.ll
blob93065a263e67a797cb87cd97cf1e711deef46d48
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
2 ; RUN: opt -S -passes=openmp-opt < %s | FileCheck %s
4 ; void foo(double x) {
5 ; #pragma omp target map(from:x)
6 ;   {
7 ;     x = sin(M_PI);
8 ; #pragma omp parallel
9 ;     { }
10 ;   }
11 ; }
13 target triple = "nvptx64"
15 %struct.ident_t = type { i32, i32, i32, i32, i8* }
17 @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
18 @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @0, i32 0, i32 0) }, align 8
19 @__omp_offloading_fd02_404433c2_main_l5_exec_mode = weak constant i8 1
20 @llvm.compiler.used = appending global [1 x i8*] [i8* @__omp_offloading_fd02_404433c2_main_l5_exec_mode], section "llvm.metadata"
22 ; Function Attrs: alwaysinline convergent norecurse nounwind
24 ; CHECK: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [23 x i8] c"
25 ; CHECK: @[[GLOB1:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @[[GLOB0]], i32 0, i32 0) }, align 8
26 ; CHECK: @[[__OMP_OFFLOADING_FD02_404433C2_MAIN_L5_EXEC_MODE:[a-zA-Z0-9_$"\\.-]+]] = weak constant i8 3
27 ; CHECK: @[[LLVM_COMPILER_USED:[a-zA-Z0-9_$"\\.-]+]] = appending global [1 x i8*] [i8* @__omp_offloading_fd02_404433c2_main_l5_exec_mode], section "llvm.metadata"
28 ; CHECK: @[[GLOB2:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 0, i32 22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @[[GLOB0]], i32 0, i32 0) }, align 8
30 define weak void @__omp_offloading_fd02_404433c2_main_l5(double* nonnull align 8 dereferenceable(8) %x) local_unnamed_addr #0 {
31 ; CHECK-LABEL: define {{[^@]+}}@__omp_offloading_fd02_404433c2_main_l5
32 ; CHECK-SAME: (double* nonnull align 8 dereferenceable(8) [[X:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
33 ; CHECK-NEXT:  entry:
34 ; CHECK-NEXT:    [[CAPTURED_VARS_ADDRS:%.*]] = alloca [0 x i8*], align 8
35 ; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(%struct.ident_t* nonnull @[[GLOB1]], i8 2, i1 false, i1 false) #[[ATTR3:[0-9]+]]
36 ; CHECK-NEXT:    [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
37 ; CHECK-NEXT:    br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[COMMON_RET:%.*]]
38 ; CHECK:       common.ret:
39 ; CHECK-NEXT:    ret void
40 ; CHECK:       user_code.entry:
41 ; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* nonnull @[[GLOB1]]) #[[ATTR3]]
42 ; CHECK-NEXT:    [[CALL_I:%.*]] = call double @__nv_sin(double 0x400921FB54442D18) #[[ATTR7:[0-9]+]]
43 ; CHECK-NEXT:    br label [[REGION_CHECK_TID:%.*]]
44 ; CHECK:       region.check.tid:
45 ; CHECK-NEXT:    [[TMP2:%.*]] = call i32 @__kmpc_get_hardware_thread_id_in_block()
46 ; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[TMP2]], 0
47 ; CHECK-NEXT:    br i1 [[TMP3]], label [[REGION_GUARDED:%.*]], label [[REGION_BARRIER:%.*]]
48 ; CHECK:       region.guarded:
49 ; CHECK-NEXT:    store double [[CALL_I]], double* [[X]], align 8, !tbaa [[TBAA8:![0-9]+]]
50 ; CHECK-NEXT:    br label [[REGION_GUARDED_END:%.*]]
51 ; CHECK:       region.guarded.end:
52 ; CHECK-NEXT:    br label [[REGION_BARRIER]]
53 ; CHECK:       region.barrier:
54 ; CHECK-NEXT:    call void @__kmpc_barrier_simple_spmd(%struct.ident_t* @[[GLOB2]], i32 [[TMP2]])
55 ; CHECK-NEXT:    br label [[REGION_EXIT:%.*]]
56 ; CHECK:       region.exit:
57 ; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds [0 x i8*], [0 x i8*]* [[CAPTURED_VARS_ADDRS]], i64 0, i64 0
58 ; CHECK-NEXT:    call void @__kmpc_parallel_51(%struct.ident_t* nonnull @[[GLOB1]], i32 [[TMP1]], i32 1, i32 -1, i32 -1, i8* bitcast (void (i32*, i32*)* @__omp_outlined__ to i8*), i8* bitcast (void (i16, i32)* @__omp_outlined___wrapper to i8*), i8** nonnull [[TMP4]], i64 0) #[[ATTR3]]
59 ; CHECK-NEXT:    call void @__kmpc_target_deinit(%struct.ident_t* nonnull @[[GLOB1]], i8 2, i1 false) #[[ATTR3]]
60 ; CHECK-NEXT:    br label [[COMMON_RET]]
62 entry:
63   %captured_vars_addrs = alloca [0 x i8*], align 8
64   %0 = call i32 @__kmpc_target_init(%struct.ident_t* nonnull @1, i8 1, i1 true, i1 true) #3
65   %exec_user_code = icmp eq i32 %0, -1
66   br i1 %exec_user_code, label %user_code.entry, label %common.ret
68 common.ret:                                       ; preds = %entry, %user_code.entry
69   ret void
71 user_code.entry:                                  ; preds = %entry
72   %1 = call i32 @__kmpc_global_thread_num(%struct.ident_t* nonnull @1)
73   %call.i = call double @__nv_sin(double 0x400921FB54442D18) #6
74   store double %call.i, double* %x, align 8, !tbaa !8
75   %2 = getelementptr inbounds [0 x i8*], [0 x i8*]* %captured_vars_addrs, i64 0, i64 0
76   call void @__kmpc_parallel_51(%struct.ident_t* nonnull @1, i32 %1, i32 1, i32 -1, i32 -1, i8* bitcast (void (i32*, i32*)* @__omp_outlined__ to i8*), i8* bitcast (void (i16, i32)* @__omp_outlined___wrapper to i8*), i8** nonnull %2, i64 0) #3
77   call void @__kmpc_target_deinit(%struct.ident_t* nonnull @1, i8 1, i1 true) #3
78   br label %common.ret
81 declare i32 @__kmpc_target_init(%struct.ident_t*, i8, i1, i1) local_unnamed_addr
83 ; Function Attrs: alwaysinline mustprogress nofree norecurse nosync nounwind readnone willreturn
84 define internal void @__omp_outlined__(i32* noalias nocapture %.global_tid., i32* noalias nocapture %.bound_tid.) #1 {
85 ; CHECK-LABEL: define {{[^@]+}}@__omp_outlined__
86 ; CHECK-SAME: (i32* noalias nocapture [[DOTGLOBAL_TID_:%.*]], i32* noalias nocapture [[DOTBOUND_TID_:%.*]]) #[[ATTR1:[0-9]+]] {
87 ; CHECK-NEXT:  entry:
88 ; CHECK-NEXT:    ret void
90 entry:
91   ret void
94 ; Function Attrs: norecurse nounwind
95 define internal void @__omp_outlined___wrapper(i16 zeroext %0, i32 %1) #2 {
96 ; CHECK-LABEL: define {{[^@]+}}@__omp_outlined___wrapper
97 ; CHECK-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
98 ; CHECK-NEXT:  entry:
99 ; CHECK-NEXT:    [[GLOBAL_ARGS:%.*]] = alloca i8**, align 8
100 ; CHECK-NEXT:    call void @__kmpc_get_shared_variables(i8*** nonnull [[GLOBAL_ARGS]]) #[[ATTR3]]
101 ; CHECK-NEXT:    ret void
103 entry:
104   %global_args = alloca i8**, align 8
105   call void @__kmpc_get_shared_variables(i8*** nonnull %global_args) #3
106   ret void
109 declare void @__kmpc_get_shared_variables(i8***) local_unnamed_addr
111 ; Function Attrs: nounwind
112 declare i32 @__kmpc_global_thread_num(%struct.ident_t*) local_unnamed_addr #3
114 ; Function Attrs: alwaysinline
115 declare void @__kmpc_parallel_51(%struct.ident_t*, i32, i32, i32, i32, i8*, i8*, i8**, i64) local_unnamed_addr #4
117 declare void @__kmpc_target_deinit(%struct.ident_t*, i8, i1) local_unnamed_addr
119 ; Function Attrs: convergent
120 declare double @__nv_sin(double) local_unnamed_addr #5
122 attributes #0 = { alwaysinline convergent norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
123 attributes #1 = { alwaysinline mustprogress nofree norecurse nosync nounwind readnone willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
124 attributes #2 = { norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
125 attributes #3 = { nounwind }
126 attributes #4 = { alwaysinline }
127 attributes #5 = { convergent "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
128 attributes #6 = { convergent nounwind "llvm.assume"="ompx_spmd_amenable" }
130 !omp_offload.info = !{!0}
131 !nvvm.annotations = !{!1}
132 !llvm.module.flags = !{!2, !3, !4, !5, !6}
133 !llvm.ident = !{!7}
135 !0 = !{i32 0, i32 64770, i32 1078211522, !"main", i32 5, i32 0}
136 !1 = !{void (double*)* @__omp_offloading_fd02_404433c2_main_l5, !"kernel", i32 1}
137 !2 = !{i32 1, !"wchar_size", i32 4}
138 !3 = !{i32 7, !"openmp", i32 50}
139 !4 = !{i32 7, !"openmp-device", i32 50}
140 !5 = !{i32 7, !"PIC Level", i32 2}
141 !6 = !{i32 7, !"frame-pointer", i32 2}
142 !7 = !{!"clang version 14.0.0"}
143 !8 = !{!9, !9, i64 0}
144 !9 = !{!"double", !10, i64 0}
145 !10 = !{!"omnipotent char", !11, i64 0}
146 !11 = !{!"Simple C/C++ TBAA"}
148 ; CHECK: attributes #[[ATTR0]] = { alwaysinline convergent norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
149 ; CHECK: attributes #[[ATTR1]] = { alwaysinline mustprogress nofree norecurse nosync nounwind readnone willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
150 ; CHECK: attributes #[[ATTR2]] = { norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
151 ; CHECK: attributes #[[ATTR3]] = { nounwind }
152 ; CHECK: attributes #[[ATTR4:[0-9]+]] = { alwaysinline }
153 ; CHECK: attributes #[[ATTR5:[0-9]+]] = { convergent "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
154 ; CHECK: attributes #[[ATTR6:[0-9]+]] = { convergent nounwind }
155 ; CHECK: attributes #[[ATTR7]] = { convergent nounwind "llvm.assume"="ompx_spmd_amenable" }
157 ; CHECK: [[META0:![0-9]+]] = !{i32 0, i32 64770, i32 1078211522, !"main", i32 5, i32 0}
158 ; CHECK: [[META1:![0-9]+]] = !{void (double*)* @__omp_offloading_fd02_404433c2_main_l5, !"kernel", i32 1}
159 ; CHECK: [[META2:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
160 ; CHECK: [[META3:![0-9]+]] = !{i32 7, !"openmp", i32 50}
161 ; CHECK: [[META4:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}
162 ; CHECK: [[META5:![0-9]+]] = !{i32 7, !"PIC Level", i32 2}
163 ; CHECK: [[META6:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
164 ; CHECK: [[META7:![0-9]+]] = !{!"clang version 14.0.0"}
165 ; CHECK: [[TBAA8]] = !{!9, !9, i64 0}
166 ; CHECK: [[META9:![0-9]+]] = !{!"double", !10, i64 0}
167 ; CHECK: [[META10:![0-9]+]] = !{!"omnipotent char", !11, i64 0}
168 ; CHECK: [[META11:![0-9]+]] = !{!"Simple C/C++ TBAA"}