Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / outlined_artificial.c
blobd4819e08d2b8e38c59dfd9a68ec691f6f636861a
1 // This testcase checks emission of DIFlagArtificial flag for outlined
2 // subroutines generated by compiler.
4 // REQUIRES: x86-registered-target
6 // RUN: %clang_cc1 -debug-info-kind=constructor -x c -verify -triple x86_64-pc-linux-gnu -fopenmp -emit-llvm %s -o - | FileCheck %s
7 // expected-no-diagnostics
9 #if defined(_WIN32)
10 #define __KAI_KMPC_CONVENTION __cdecl
11 #else
12 #define __KAI_KMPC_CONVENTION
13 #endif
15 extern int printf(const char *, ...);
16 extern void __KAI_KMPC_CONVENTION omp_set_num_threads(int);
17 extern int __KAI_KMPC_CONVENTION omp_get_thread_num(void);
19 #define N 10
21 float f[10];
22 void foo_simd(int low, int up) {
23 for (int i = low; i < up; ++i) {
24 f[i] = 0.0;
25 #pragma omp ordered simd
26 f[i] = 1.0;
30 int main() {
31 int arr[10];
32 int i;
33 omp_set_num_threads(2);
34 #pragma omp parallel
35 #pragma omp single
36 #pragma omp taskloop num_tasks(10)
37 for (i = 0; i < N; i++) {
38 arr[i] = i * i;
41 for (int j = 0; j < N; j++) {
42 printf("%d\n", arr[j]);
44 return 0;
47 // foo_simd is not artificial.
48 // CHECK-DAG: !DISubprogram(name: "foo_simd"
49 // CHECK-DAG-SAME: flags: DIFlagPrototyped,
51 // CHECK-DAG: !DISubprogram(name: "__captured_stmt_debug__"
52 // CHECK-DAG-SAME: flags: DIFlagArtificial
54 // CHECK-DAG: !DISubprogram(name: "__captured_stmt"
55 // CHECK-DAG-SAME: flags: DIFlagArtificial
57 // CHECK-DAG: !DISubprogram(name: "main.omp_outlined_debug__"
58 // CHECK-DAG-SAME: flags: DIFlagArtificial
60 // CHECK-DAG: !DISubprogram(linkageName: ".omp_task_entry."
61 // CHECK-DAG-SAME: flags: DIFlagArtificial
63 // CHECK-DAG: !DISubprogram(name: ".omp_outlined."
64 // CHECK-DAG-SAME: flags: DIFlagArtificial
66 // CHECK-DAG: !DISubprogram(name: "main.omp_outlined"
67 // CHECK-DAG-SAME: flags: DIFlagArtificial