Split test-specific passes out of mlir-opt
authorNicolas Vasilache <ntv@google.com>
Mon, 24 Jun 2019 21:35:21 +0000 (14:35 -0700)
committerjpienaar <jpienaar@google.com>
Tue, 25 Jun 2019 00:47:12 +0000 (17:47 -0700)
Instead put their impl in test/lib and link them into mlir-test-opt

PiperOrigin-RevId: 254837439

24 files changed:
mlir/lib/Transforms/CMakeLists.txt
mlir/test/CMakeLists.txt
mlir/test/IR/attribute.mlir
mlir/test/IR/operand.mlir
mlir/test/IR/region.mlir
mlir/test/IR/result.mlir
mlir/test/IR/traits.mlir
mlir/test/Transforms/test-legalizer.mlir
mlir/test/lib/CMakeLists.txt [new file with mode: 0644]
mlir/test/lib/TestDialect/CMakeLists.txt [moved from mlir/test/TestDialect/CMakeLists.txt with 61% similarity]
mlir/test/lib/TestDialect/TestDialect.cpp [moved from mlir/test/TestDialect/TestDialect.cpp with 100% similarity]
mlir/test/lib/TestDialect/TestDialect.h [moved from mlir/test/TestDialect/TestDialect.h with 100% similarity]
mlir/test/lib/TestDialect/TestOps.td [moved from mlir/test/TestDialect/TestOps.td with 100% similarity]
mlir/test/lib/TestDialect/TestPatterns.cpp [moved from mlir/test/TestDialect/TestPatterns.cpp with 100% similarity]
mlir/test/lib/TestDialect/lit.local.cfg [moved from mlir/test/TestDialect/lit.local.cfg with 100% similarity]
mlir/test/lib/Transforms/CMakeLists.txt [new file with mode: 0644]
mlir/test/lib/Transforms/TestConstantFold.cpp [moved from mlir/lib/Transforms/TestConstantFold.cpp with 100% similarity]
mlir/test/lib/Transforms/TestLoopFusion.cpp [moved from mlir/lib/Transforms/TestLoopFusion.cpp with 100% similarity]
mlir/test/lib/Transforms/TestVectorizationUtils.cpp [moved from mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp with 100% similarity]
mlir/test/lit.cfg.py
mlir/test/mlir-tblgen/pattern.mlir
mlir/test/mlir-tblgen/types.mlir
mlir/test/mlir-tblgen/verify-unused-value.mlir
mlir/tools/mlir-opt/CMakeLists.txt

index eb1846d..c3f3420 100644 (file)
@@ -16,8 +16,6 @@ add_llvm_library(MLIRTransforms
   PipelineDataTransfer.cpp
   SimplifyAffineStructures.cpp
   StripDebugInfo.cpp
-  TestConstantFold.cpp
-  TestLoopFusion.cpp
   Utils/FoldUtils.cpp
   Utils/GreedyPatternRewriteDriver.cpp
   Utils/LoopFusionUtils.cpp
@@ -26,7 +24,6 @@ add_llvm_library(MLIRTransforms
   Utils/Utils.cpp
   Vectorization
   Vectorize.cpp
-  Vectorization/VectorizerTestPass.cpp
   ViewFunctionGraph.cpp
 
   ADDITIONAL_HEADER_DIRS
index f377ce4..a57505d 100644 (file)
@@ -1,7 +1,7 @@
 add_subdirectory(EDSC)
 add_subdirectory(mlir-cpu-runner)
 add_subdirectory(SDBM)
-add_subdirectory(TestDialect)
+add_subdirectory(lib)
 
 llvm_canonicalize_cmake_booleans(
   LLVM_BUILD_EXAMPLES
@@ -32,7 +32,6 @@ set(MLIR_TEST_DEPENDS
   mlir-opt
   mlir-sdbm-api-test
   mlir-tblgen
-  mlir-test-opt
   mlir-translate
   cblas
   cblas_interface
index 4963e8f..09c5382 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Test TypeArrayAttr
index b000277..3ca8832 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Test mixed normal and variadic operands
index 7516a37..27e19d6 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Test the number of regions
index 34eccfb..cef89b2 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Test mixed normal and variadic results
index 40c3709..281e3c0 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 // CHECK: succeededSameOperandAndResultElementType
 func @succeededSameOperandAndResultElementType(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>) {
index 449fba9..1661175 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt -test-legalize-patterns -split-input-file -verify-diagnostics %s | FileCheck %s --dump-input=fail
+// RUN: mlir-opt -test-legalize-patterns -split-input-file -verify-diagnostics %s | FileCheck %s --dump-input=fail
 
 // CHECK-LABEL: verifyDirectPattern
 func @verifyDirectPattern() -> i32 {
diff --git a/mlir/test/lib/CMakeLists.txt b/mlir/test/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..860376b
--- /dev/null
@@ -0,0 +1,2 @@
+add_subdirectory(TestDialect)
+add_subdirectory(Transforms)
similarity index 61%
rename from mlir/test/TestDialect/CMakeLists.txt
rename to mlir/test/lib/TestDialect/CMakeLists.txt
index dfd9686..163af2f 100644 (file)
@@ -15,25 +15,10 @@ add_llvm_library(MLIRTestDialect
 )
 add_dependencies(MLIRTestDialect
   MLIRTestOpsIncGen
+  MLIRTypeUtilities
   LLVMSupport
 )
 target_link_libraries(MLIRTestDialect
-  LLVMSupport
-)
-
-add_llvm_executable(mlir-test-opt
-  ${MLIR_MAIN_SRC_DIR}/../tools/mlir-opt/mlir-opt.cpp
-  TestDialect.cpp
-  TestPatterns.cpp
-)
-llvm_update_compile_flags(mlir-test-opt)
-whole_archive_link(mlir-test-opt
-  MLIRStandardOps
-)
-target_link_libraries(mlir-test-opt
-  PRIVATE
-  MLIRMlirOptLib
-  MLIROptMain
   MLIRTypeUtilities
   LLVMSupport
 )
diff --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cb7048b
--- /dev/null
@@ -0,0 +1,15 @@
+add_llvm_library(MLIRTestTransforms
+  TestConstantFold.cpp
+  TestLoopFusion.cpp
+  TestVectorizationUtils.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
+  )
+add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
+target_link_libraries(MLIRTestTransforms
+  MLIRAffineOps
+  MLIRAnalysis
+  MLIRPass
+  MLIRVectorOps
+  )
index d978e9d..3e6dfc3 100644 (file)
@@ -55,7 +55,6 @@ tool_dirs = [config.mlir_tools_dir, config.llvm_tools_dir]
 tools = [
     'mlir-opt',
     'mlir-tblgen',
-    'mlir-test-opt',
     'mlir-translate',
     'mlir-edsc-builder-api-test',
 ]
index 22a9129..3ed678c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt -test-patterns -mlir-print-debuginfo %s | FileCheck %s
+// RUN: mlir-opt -test-patterns -mlir-print-debuginfo %s | FileCheck %s
 
 // CHECK-LABEL: verifyConstantAttr
 func @verifyConstantAttr(%arg0 : i32) -> i32 {
index 044f822..f498ba3 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt %s -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
 
 // -----
 
index 36ce869..f5f524d 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: mlir-test-opt -test-patterns %s | FileCheck %s
+// RUN: mlir-opt -test-patterns %s | FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Test 'verifyUnusedValue'
index 737c26c..f49cbc3 100644 (file)
@@ -35,6 +35,8 @@ set(LIBS
   MLIRStandardOps
   MLIRStandardToLLVM
   MLIRTransforms
+  MLIRTestDialect
+  MLIRTestTransforms
   MLIRSupport
   MLIRVectorOps
 )