diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index e904937317cc0..b062406f9eba4 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -20,6 +20,7 @@ #include "flang/Lower/IO.h" #include "flang/Lower/IterationSpace.h" #include "flang/Lower/Mangler.h" +#include "flang/Lower/OpenMP.h" #include "flang/Lower/PFTBuilder.h" #include "flang/Lower/Runtime.h" #include "flang/Lower/StatementContext.h" @@ -1200,8 +1201,15 @@ class FirConverter : public Fortran::lower::AbstractConverter { TODO(toLocation(), "OpenACCDeclarativeConstruct lowering"); } - void genFIR(const Fortran::parser::OpenMPConstruct &) { - TODO(toLocation(), "OpenMPConstruct lowering"); + void genFIR(const Fortran::parser::OpenMPConstruct &omp) { + mlir::OpBuilder::InsertPoint insertPt = builder->saveInsertionPoint(); + localSymbols.pushScope(); + Fortran::lower::genOpenMPConstruct(*this, getEval(), omp); + + for (Fortran::lower::pft::Evaluation &e : getEval().getNestedEvaluations()) + genFIR(e); + localSymbols.popScope(); + builder->restoreInsertionPoint(insertPt); } void genFIR(const Fortran::parser::OpenMPDeclarativeConstruct &) { diff --git a/flang/test/Lower/OpenMP/simple-barrier.f90 b/flang/test/Lower/OpenMP/simple-barrier.f90 new file mode 100644 index 0000000000000..c621b8062eaaa --- /dev/null +++ b/flang/test/Lower/OpenMP/simple-barrier.f90 @@ -0,0 +1,6 @@ +! RUN: bbc -fopenmp -emit-fir -o - %s | FileCheck %s + +subroutine sample() +! CHECK: omp.barrier +!$omp barrier +end subroutine sample