================
@@ -0,0 +1,171 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -fclangir 
-emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefixes=LLVM,CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp -emit-llvm %s -o 
%t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefixes=LLVM,OGCG
+
+// Check the LLVM IR of omp single from ClangIR and classic codegen. The
+// prefixes are LLVM (checks shared by both paths), CIR (IR lowered from
+// ClangIR) and OGCG (IR from the original, classic Clang codegen).
+
+void work(void);
+void other_work(void);
+
+void single_only(void) {
+#pragma omp single
+  work();
+}
+
+// LLVM-LABEL: define {{.*}}void @single_only()
+// LLVM:         call i32 @__kmpc_single(
+// LLVM:         call void @work()
+// LLVM:         call void @__kmpc_end_single(
+// LLVM:         call void @__kmpc_barrier(
+
+void nowait_single_only(void) {
+#pragma omp single nowait
+  work();
+}
+
+// LLVM-LABEL: define {{.*}}void @nowait_single_only()
+// LLVM:         call i32 @__kmpc_single(
+// LLVM:         call void @work()
+// LLVM:         call void @__kmpc_end_single(
+// LLVM-NOT:     @__kmpc_barrier
+
+void single_inside_parallel(void) {
+#pragma omp parallel
+  {
+#pragma omp single
+    work();
+  }
+}
+
+// CIR-LABEL: define {{.*}}void @single_inside_parallel()
+// CIR:         call {{.*}}@__kmpc_fork_call(
+// CIR-LABEL: define {{.*}}void @single_inside_parallel..omp_par(
----------------
steffenlarsen wrote:

The `..omp_par` (which looks weird, is the double dots intentional) and 
`.omp_outlined` in the names seem to be the main point of divergence between 
CIR and OGCG in this test. Is this divergence intended or can we make them 
generate teh same names?

https://github.com/llvm/llvm-project/pull/243797
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to