[clang] [CIR] [OpenMP] Implement codegen for OpenMP `master` directive (PR #238260)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 05:00:22 PST 2026


================
@@ -77,24 +112,60 @@ void lambda_master(int a, int b) {
 #pragma omp master
     {
       // ALL: call i32 @__kmpc_master(
+      // CIR-LABEL: cir.func{{.*}} @_ZZ13lambda_masteriiENK{{.*}}clEv(
+      // CIR: omp.parallel {
+      // CIR-NEXT: omp.master {
+      // CIR-NEXT: [[C_ADDR:%.*]] = cir.alloca "c"
+      // CIR: [[SUM:%.*]] = cir.add nsw
+      // CIR-NEXT: cir.store align(4) [[SUM]], [[C_ADDR]]
+      // CIR-NEXT: omp.terminator
+      // CIR-NEXT: }
+      // CIR-NEXT: omp.terminator
+      // CIR-NEXT: }
       int c = a + b;
     }
   };
 
   l1();
 
+#ifndef CIR_TEST
----------------
steffenlarsen wrote:

Is this a TODO outside the current patch?

https://github.com/llvm/llvm-project/pull/238260


More information about the cfe-commits mailing list