[Mlir-commits] [mlir] 4809580 - [mlir] Add a test for OperationFolder

Alex Zinenko llvmlistbot at llvm.org
Thu May 7 03:42:17 PDT 2020


Author: Alex Zinenko
Date: 2020-05-07T12:39:24+02:00
New Revision: 4809580463380b8366309eb29073fda69d9bbf43

URL: https://github.com/llvm/llvm-project/commit/4809580463380b8366309eb29073fda69d9bbf43
DIFF: https://github.com/llvm/llvm-project/commit/4809580463380b8366309eb29073fda69d9bbf43.diff

LOG: [mlir] Add a test for OperationFolder

Adds a test exercising the rewriting pattern in the test dialect that calls
OperationFolder.create.

Added: 
    mlir/test/Transforms/test-operation-folder.mlir

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/mlir/test/Transforms/test-operation-folder.mlir b/mlir/test/Transforms/test-operation-folder.mlir
new file mode 100644
index 000000000000..7ef65303aa81
--- /dev/null
+++ b/mlir/test/Transforms/test-operation-folder.mlir
@@ -0,0 +1,12 @@
+// RUN: mlir-opt -test-patterns %s | FileCheck %s
+
+func @foo() -> i32 {
+  %c42 = constant 42 : i32
+
+  // The new operation should be present in the output and contain an attribute
+  // with value "42" that results from folding.
+
+  // CHECK: "test.op_in_place_fold"(%{{.*}}) {attr = 42 : i32}
+  %0 = "test.op_in_place_fold_anchor"(%c42) : (i32) -> (i32)
+  return %0 : i32
+}


        


More information about the Mlir-commits mailing list