1; RUN: opt -passes=openmp-opt-cgscc -debug-only=openmp-opt -disable-output < %s 2>&1 | FileCheck %s
2; REQUIRES: asserts
3; ModuleID = 'single_threaded_exeuction.c'
4
5%struct.ident_t = type { i32, i32, i32, i32, i8* }
6
7@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
8@0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
9@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
10
11; CHECK: [openmp-opt] Basic block @bar entry is executed by a single thread.
12; Function Attrs: noinline nounwind uwtable
13define internal void @bar() {
14entry:
15  ret void
16}
17
18; CHECK-NOT: [openmp-opt] Basic block @foo entry is executed by a single thread.
19; CHECK: [openmp-opt] Basic block @foo if.then is executed by a single thread.
20; CHECK-NOT: [openmp-opt] Basic block @foo if.end is executed by a single thread.
21; Function Attrs: noinline nounwind uwtable
22define dso_local void @foo() {
23entry:
24  %call = call i32 @omp_get_thread_num()
25  %cmp = icmp eq i32 %call, 0
26  br i1 %cmp, label %if.then, label %if.end
27
28if.then:
29  call void @bar()
30  br label %if.end
31
32if.end:
33  ret void
34}
35
36declare dso_local i32 @omp_get_thread_num()
37
38!llvm.module.flags = !{!0}
39!llvm.ident = !{!1}
40
41!0 = !{i32 1, !"wchar_size", i32 4}
42!1 = !{!"clang version 13.0.0"}
43!2 = !{!3}
44!3 = !{i64 2, i64 -1, i64 -1, i1 true}
45