1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // Check that the CHECK lines are generated for clang-generated functions
3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck --check-prefix=OMP %s
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck --check-prefix=NOOMP %s
6 const int size = 1024 * 1024 * 32;
14 // OMP-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
15 // OMP-NEXT: [[I:%.*]] = alloca i32, align 4
16 // OMP-NEXT: store i32 0, ptr [[RETVAL]], align 4
17 // OMP-NEXT: store i32 0, ptr [[I]], align 4
18 // OMP-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB2:[0-9]+]], i32 0, ptr @main.omp_outlined)
19 // OMP-NEXT: call void @foo()
20 // OMP-NEXT: ret i32 0
22 // NOOMP-LABEL: @main(
24 // NOOMP-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
25 // NOOMP-NEXT: [[I:%.*]] = alloca i32, align 4
26 // NOOMP-NEXT: store i32 0, ptr [[RETVAL]], align 4
27 // NOOMP-NEXT: store i32 0, ptr [[I]], align 4
28 // NOOMP-NEXT: store i32 0, ptr [[I]], align 4
29 // NOOMP-NEXT: br label [[FOR_COND:%.*]]
31 // NOOMP-NEXT: [[TMP0:%.*]] = load i32, ptr [[I]], align 4
32 // NOOMP-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], 33554432
33 // NOOMP-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
35 // NOOMP-NEXT: [[TMP1:%.*]] = load i32, ptr [[I]], align 4
36 // NOOMP-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP1]] to i64
37 // NOOMP-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [33554432 x double], ptr @A, i64 0, i64 [[IDXPROM]]
38 // NOOMP-NEXT: store double 0.000000e+00, ptr [[ARRAYIDX]], align 8
39 // NOOMP-NEXT: br label [[FOR_INC:%.*]]
41 // NOOMP-NEXT: [[TMP2:%.*]] = load i32, ptr [[I]], align 4
42 // NOOMP-NEXT: [[INC:%.*]] = add nsw i32 [[TMP2]], 1
43 // NOOMP-NEXT: store i32 [[INC]], ptr [[I]], align 4
44 // NOOMP-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP2:![0-9]+]]
46 // NOOMP-NEXT: call void @foo()
47 // NOOMP-NEXT: ret i32 0
52 #pragma omp parallel for
53 for (i = 0; i < size; ++i) {
64 // OMP-NEXT: [[I:%.*]] = alloca i32, align 4
65 // OMP-NEXT: store i32 0, ptr [[I]], align 4
66 // OMP-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB2]], i32 0, ptr @foo.omp_outlined)
71 // NOOMP-NEXT: [[I:%.*]] = alloca i32, align 4
72 // NOOMP-NEXT: store i32 0, ptr [[I]], align 4
73 // NOOMP-NEXT: store i32 0, ptr [[I]], align 4
74 // NOOMP-NEXT: br label [[FOR_COND:%.*]]
76 // NOOMP-NEXT: [[TMP0:%.*]] = load i32, ptr [[I]], align 4
77 // NOOMP-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], 33554432
78 // NOOMP-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
80 // NOOMP-NEXT: [[TMP1:%.*]] = load i32, ptr [[I]], align 4
81 // NOOMP-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP1]] to i64
82 // NOOMP-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [33554432 x double], ptr @A, i64 0, i64 [[IDXPROM]]
83 // NOOMP-NEXT: store double 1.000000e+00, ptr [[ARRAYIDX]], align 8
84 // NOOMP-NEXT: br label [[FOR_INC:%.*]]
86 // NOOMP-NEXT: [[TMP2:%.*]] = load i32, ptr [[I]], align 4
87 // NOOMP-NEXT: [[INC:%.*]] = add nsw i32 [[TMP2]], 1
88 // NOOMP-NEXT: store i32 [[INC]], ptr [[I]], align 4
89 // NOOMP-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP4:![0-9]+]]
91 // NOOMP-NEXT: ret void
96 #pragma omp parallel for
97 for (i = 0; i < size; ++i) {