[flang] Removed OpenMP lowering unittests
authorSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Wed, 23 Sep 2020 12:32:49 +0000 (18:02 +0530)
committerSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Wed, 23 Sep 2020 12:45:34 +0000 (18:15 +0530)
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

flang/unittests/CMakeLists.txt
flang/unittests/Lower/CMakeLists.txt [deleted file]
flang/unittests/Lower/OpenMPLoweringTest.cpp [deleted file]

index c88e9fc..9f068fb 100644 (file)
@@ -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 (file)
index 19535e8..0000000
+++ /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 (file)
index dc002ce..0000000
+++ /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