[flang-commits] [flang] be1197c - [flang] Removed OpenMP lowering unittests
Sourabh Singh Tomar via flang-commits
flang-commits at lists.llvm.org
Wed Sep 23 05:46:38 PDT 2020
Author: Sourabh Singh Tomar
Date: 2020-09-23T18:15:34+05:30
New Revision: be1197c403b22291e35cbc5e96788860ceabd40c
URL: https://github.com/llvm/llvm-project/commit/be1197c403b22291e35cbc5e96788860ceabd40c
DIFF: https://github.com/llvm/llvm-project/commit/be1197c403b22291e35cbc5e96788860ceabd40c.diff
LOG: [flang] Removed OpenMP lowering unittests
These tests aren't adding much value and consensus has been reached for
there removal.
For more context, please refer to discussion in this revision:
https://reviews.llvm.org/D87846
Added:
Modified:
flang/unittests/CMakeLists.txt
Removed:
flang/unittests/Lower/CMakeLists.txt
flang/unittests/Lower/OpenMPLoweringTest.cpp
################################################################################
diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index c88e9fc660f1..9f068fb30ffa 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -21,7 +21,6 @@ add_subdirectory(Optimizer)
add_subdirectory(Decimal)
add_subdirectory(Evaluate)
add_subdirectory(Runtime)
-add_subdirectory(Lower)
if (FLANG_BUILD_NEW_DRIVER)
add_subdirectory(Frontend)
diff --git a/flang/unittests/Lower/CMakeLists.txt b/flang/unittests/Lower/CMakeLists.txt
deleted file mode 100644
index 19535e8f4534..000000000000
--- a/flang/unittests/Lower/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
-
-set(LIBS
- MLIRLLVMIR
- ${dialect_libs}
-)
-
-add_flang_unittest(FlangLoweringOpenMPTests
- OpenMPLoweringTest.cpp
-)
-target_link_libraries(FlangLoweringOpenMPTests
- PRIVATE
- ${LIBS})
diff --git a/flang/unittests/Lower/OpenMPLoweringTest.cpp b/flang/unittests/Lower/OpenMPLoweringTest.cpp
deleted file mode 100644
index dc002cef1a52..000000000000
--- a/flang/unittests/Lower/OpenMPLoweringTest.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//===- OpenMPLoweringTest.cpp -- OpenMPLowering unit tests ----------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "gtest/gtest.h"
-#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/InitAllDialects.h"
-#include "flang/Parser/parse-tree.h"
-#include "llvm/Frontend/OpenMP/OMPConstants.h"
-
-class OpenMPLoweringTest : public testing::Test {
-protected:
- void SetUp() override {
- ctx.loadDialect<mlir::omp::OpenMPDialect>();
- mlir::registerAllDialects(ctx.getDialectRegistry());
- mlirOpBuilder.reset(new mlir::OpBuilder(&ctx));
- }
-
- void TearDown() override { mlirOpBuilder.reset(); }
-
- mlir::MLIRContext ctx;
- std::unique_ptr<mlir::OpBuilder> mlirOpBuilder;
-};
-
-TEST_F(OpenMPLoweringTest, Barrier) {
- // Construct a dummy parse tree node for `!OMP barrier`.
- struct Fortran::parser::OmpSimpleStandaloneDirective barrierDirective(
- llvm::omp::Directive::OMPD_barrier);
-
- // Check and lower the `!OMP barrier` node to `BarrierOp` operation of
- // OpenMPDialect.
- EXPECT_EQ(barrierDirective.v, llvm::omp::Directive::OMPD_barrier);
- auto barrierOp = mlirOpBuilder->create<mlir::omp::BarrierOp>(
- mlirOpBuilder->getUnknownLoc());
-
- EXPECT_EQ(barrierOp.getOperationName(), "omp.barrier");
- EXPECT_EQ(succeeded(barrierOp.verify()), true);
-}
-
-TEST_F(OpenMPLoweringTest, TaskWait) {
- // Construct a dummy parse tree node for `!OMP taskwait`.
- struct Fortran::parser::OmpSimpleStandaloneDirective taskWaitDirective(
- llvm::omp::Directive::OMPD_taskwait);
-
- // Check and lower the `!OMP taskwait` node to `TaskwaitOp` operation of
- // OpenMPDialect.
- EXPECT_EQ(taskWaitDirective.v, llvm::omp::Directive::OMPD_taskwait);
- auto taskWaitOp = mlirOpBuilder->create<mlir::omp::TaskwaitOp>(
- mlirOpBuilder->getUnknownLoc());
-
- EXPECT_EQ(taskWaitOp.getOperationName(), "omp.taskwait");
- EXPECT_EQ(succeeded(taskWaitOp.verify()), true);
-}
-
-TEST_F(OpenMPLoweringTest, TaskYield) {
- // Construct a dummy parse tree node for `!OMP taskyield`.
- struct Fortran::parser::OmpSimpleStandaloneDirective taskYieldDirective(
- llvm::omp::Directive::OMPD_taskyield);
-
- // Check and lower the `!OMP taskyield` node to `TaskYieldOp` operation of
- // OpenMPDialect.
- EXPECT_EQ(taskYieldDirective.v, llvm::omp::Directive::OMPD_taskyield);
- auto taskYieldOp = mlirOpBuilder->create<mlir::omp::TaskyieldOp>(
- mlirOpBuilder->getUnknownLoc());
-
- EXPECT_EQ(taskYieldOp.getOperationName(), "omp.taskyield");
- EXPECT_EQ(succeeded(taskYieldOp.verify()), true);
-}
-
-TEST_F(OpenMPLoweringTest, EmptyParallel) {
- // Construct a dummy parse tree node for `!OMP parallel`.
- struct Fortran::parser::OmpSimpleStandaloneDirective parallelDirective(
- llvm::omp::Directive::OMPD_parallel);
-
- // Check and lower the `!OMP parallel` node to `ParallelOp` operation of
- // OpenMPDialect.
- EXPECT_EQ(parallelDirective.v, llvm::omp::Directive::OMPD_parallel);
- auto insertPt = mlirOpBuilder->saveInsertionPoint();
- llvm::ArrayRef<mlir::Type> argTy;
- mlir::ValueRange range;
- llvm::SmallVector<int32_t, 6> operandSegmentSizes(6 /*Size=*/, 0 /*Value=*/);
- // create and insert the operation.
- auto parallelOp = mlirOpBuilder->create<mlir::omp::ParallelOp>(
- mlirOpBuilder->getUnknownLoc(), argTy, range);
- parallelOp.setAttr(mlir::omp::ParallelOp::getOperandSegmentSizeAttr(),
- mlirOpBuilder->getI32VectorAttr(operandSegmentSizes));
- parallelOp.getRegion().push_back(new mlir::Block{});
- auto &block = parallelOp.getRegion().back();
- mlirOpBuilder->setInsertionPointToStart(&block);
- // ensure the block is well-formed.
- mlirOpBuilder->create<mlir::omp::TerminatorOp>(
- mlirOpBuilder->getUnknownLoc());
- mlirOpBuilder->restoreInsertionPoint(insertPt);
- EXPECT_EQ(succeeded(parallelOp.verify()), true);
-}
-
-// main() from gtest_main
More information about the flang-commits
mailing list