1+ ; RUN: opt -S -openmpopt -stats < %s 2>&1 | FileCheck %s
2+ ; REQUIRES: asserts
3+
4+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5+
6+ %struct.ident_t = type { i32 , i32 , i32 , i32 , i8* }
7+
8+ @.str = private unnamed_addr constant [23 x i8 ] c ";unknown;unknown;0;0;;\00 " , align 1
9+ @0 = private unnamed_addr global %struct.ident_t { i32 0 , i32 2 , i32 0 , i32 0 , i8* getelementptr inbounds ([23 x i8 ], [23 x i8 ]* @.str , i32 0 , i32 0 ) }, align 8
10+ @1 = private unnamed_addr global %struct.ident_t { i32 0 , i32 322 , i32 0 , i32 0 , i8* getelementptr inbounds ([23 x i8 ], [23 x i8 ]* @.str , i32 0 , i32 0 ) }, align 8
11+
12+ define i32 @main () {
13+ entry:
14+
15+ call void (%struct.ident_t* , void (i32* , i32* , ...)*, ...) @__kmpc_fork_call (%struct.ident_t* nonnull @0 , void (i32* , i32* , ...)* bitcast (void (i32* , i32* )* @.omp_outlined. to void (i32* , i32* , ...)*))
16+ ret i32 0
17+ }
18+
19+ ; Only the last runtime call will be matched due that the rest of the "runtime function" calls
20+ ; have some type mismatch compared to the real runtime function. See the check at bottom.
21+ define internal void @.omp_outlined. (i32* noalias %.global_tid. , i32* noalias %.bound_tid. ) {
22+ entry:
23+
24+ call void @__kmpc_master (%struct.ident_t* nonnull @0 )
25+ call void @__kmpc_end_master (%struct.ident_t* nonnull @0 , i32 0 , i32 0 )
26+ call void @__kmpc_barrier (%struct.ident_t* nonnull @1 , float 0 .0 )
27+ call void @omp_get_thread_num ()
28+ call void @__kmpc_flush (%struct.ident_t* nonnull @0 )
29+ ret void
30+ }
31+ ; Fewer arguments than expected in variadic function.
32+ declare !callback !2 void @__kmpc_fork_call (%struct.ident_t* , void (i32* , i32* , ...)*, ...)
33+
34+ ; Fewer number of arguments in non variadic function.
35+ declare void @__kmpc_master (%struct.ident_t* )
36+
37+ ; Bigger number of arguments in non variadic function.
38+ declare void @__kmpc_end_master (%struct.ident_t* , i32 , i32 )
39+
40+ ; Different argument type than the expected.
41+ declare void @__kmpc_barrier (%struct.ident_t* , float )
42+
43+ ; Proper use of runtime function.
44+ declare void @__kmpc_flush (%struct.ident_t* )
45+
46+ ; Different return type.
47+ declare void @omp_get_thread_num ()
48+
49+ !llvm.module.flags = !{!0 }
50+ !llvm.ident = !{!1 }
51+
52+ !0 = !{i32 1 , !"wchar_size" , i32 4 }
53+ !1 = !{!"clang" }
54+ !2 = !{!3 }
55+ !3 = !{i64 2 , i64 -1 , i64 -1 , i1 true }
56+ ; ===-------------------------------------------------------------------------===
57+ ; ... Statistics Collected ...
58+ ; ===-------------------------------------------------------------------------===
59+ ;
60+ ; CHECK: 1 cgscc-passmgr - Maximum CGSCCPassMgr iterations on one SCC
61+ ; CHECK: 2 openmp-opt{{.*}}Number of OpenMP runtime functions identified
62+ ;
63+ ; There are two matches since the pass is run once per function.
0 commit comments