Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ CIRGenFunction::emitOMPTaskyieldDirective(const OMPTaskyieldDirective &s) {
}
mlir::LogicalResult
CIRGenFunction::emitOMPBarrierDirective(const OMPBarrierDirective &s) {
getCIRGenModule().errorNYI(s.getSourceRange(), "OpenMP OMPBarrierDirective");
return mlir::failure();
mlir::omp::BarrierOp::create(builder, getLoc(s.getBeginLoc()));
assert(s.clauses().empty() && "omp barrier doesn't support clauses");
return mlir::success();
}
mlir::LogicalResult
CIRGenFunction::emitOMPMetaDirective(const OMPMetaDirective &s) {
Expand Down
14 changes: 14 additions & 0 deletions clang/test/CIR/CodeGenOpenMP/barrier.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 -fopenmp -emit-cir -fclangir %s -o - | FileCheck %s

void before(void);
void after(void);

void emit_simple_barrier() {
// CHECK: cir.func{{.*}}@emit_simple_barrier
before();
// CHECK-NEXT: cir.call @before
#pragma omp barrier
// CHECK-NEXT: omp.barrier
after();
// CHECK-NEXT: cir.call @after
}