summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib/Transforms
diff options
context:
space:
mode:
authorMarcel Koester <marcel.koester@dfki.de>2019-12-11 01:02:39 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-11 01:03:25 -0800
commit98fbf41044d3364dbaf18db81b9e8d9520d14761 (patch)
tree2b92a39808cfb7aa7d4c1f21b032313eaf70ada8 /mlir/test/lib/Transforms
parent9826fe5c9fb65da8f1d53b21348f013c58c09791 (diff)
downloadbcm5719-llvm-98fbf41044d3364dbaf18db81b9e8d9520d14761.tar.gz
bcm5719-llvm-98fbf41044d3364dbaf18db81b9e8d9520d14761.zip
Add initial liveness analysis including test cases.
Closes tensorflow/mlir#255 PiperOrigin-RevId: 284935454
Diffstat (limited to 'mlir/test/lib/Transforms')
-rw-r--r--mlir/test/lib/Transforms/CMakeLists.txt1
-rw-r--r--mlir/test/lib/Transforms/TestLiveness.cpp42
2 files changed, 43 insertions, 0 deletions
diff --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt
index 2d5f37a5fc5..b6338e1d167 100644
--- a/mlir/test/lib/Transforms/CMakeLists.txt
+++ b/mlir/test/lib/Transforms/CMakeLists.txt
@@ -4,6 +4,7 @@ add_llvm_library(MLIRTestTransforms
TestLoopFusion.cpp
TestInlining.cpp
TestLinalgTransforms.cpp
+ TestLiveness.cpp
TestLoopMapping.cpp
TestLoopParametricTiling.cpp
TestOpaqueLoc.cpp
diff --git a/mlir/test/lib/Transforms/TestLiveness.cpp b/mlir/test/lib/Transforms/TestLiveness.cpp
new file mode 100644
index 00000000000..d97060247f4
--- /dev/null
+++ b/mlir/test/lib/Transforms/TestLiveness.cpp
@@ -0,0 +1,42 @@
+//===- TestLiveness.cpp - Test liveness construction and information
+//-------===//
+//
+// Copyright 2019 The MLIR Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// =============================================================================
+//
+// This file contains test passes for constructing and resolving liveness
+// information.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Analysis/Liveness.h"
+#include "mlir/Pass/Pass.h"
+
+using namespace mlir;
+
+namespace {
+
+struct TestLivenessPass : public FunctionPass<TestLivenessPass> {
+ void runOnFunction() override {
+ llvm::errs() << "Testing : " << getFunction().getName() << "\n";
+ getAnalysis<Liveness>().print(llvm::errs());
+ }
+};
+
+} // end anonymous namespace
+
+static PassRegistration<TestLivenessPass>
+ pass("test-print-liveness",
+ "Print the contents of a constructed liveness information.");
OpenPOWER on IntegriCloud