[Mlir-commits] [mlir] 967f07f - Revert "[mlir] Add folder for complex.ReOp and complex.ImOp."

Adrian Kuegel llvmlistbot at llvm.org
Mon May 17 04:50:01 PDT 2021


Author: Adrian Kuegel
Date: 2021-05-17T13:49:42+02:00
New Revision: 967f07f5476a8d7884c822a7d92d83f7f68d5dad

URL: https://github.com/llvm/llvm-project/commit/967f07f5476a8d7884c822a7d92d83f7f68d5dad
DIFF: https://github.com/llvm/llvm-project/commit/967f07f5476a8d7884c822a7d92d83f7f68d5dad.diff

LOG: Revert "[mlir] Add folder for complex.ReOp and complex.ImOp."

This reverts commit 6b49834d652ba70fc24eaea1c37330639d697de5.

Some tests fail.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
    mlir/lib/Dialect/Complex/IR/ComplexOps.cpp

Removed: 
    mlir/test/Dialect/Complex/canonicalize.mlir


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
index efea0b284552e..5e4648da488d6 100644
--- a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
+++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
@@ -144,7 +144,6 @@ def ImOp : Complex_Op<"im",
   let results = (outs AnyFloat:$imaginary);
 
   let assemblyFormat = "$complex attr-dict `:` type($complex)";
-  let hasFolder = 1;
 }
 
 //===----------------------------------------------------------------------===//
@@ -186,7 +185,6 @@ def ReOp : Complex_Op<"re",
   let results = (outs AnyFloat:$real);
 
   let assemblyFormat = "$complex attr-dict `:` type($complex)";
-  let hasFolder = 1;
 }
 
 

diff  --git a/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp b/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
index 37fae63edf98e..6b4855dc4339b 100644
--- a/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
+++ b/mlir/lib/Dialect/Complex/IR/ComplexOps.cpp
@@ -17,13 +17,3 @@ using namespace mlir::complex;
 
 #define GET_OP_CLASSES
 #include "mlir/Dialect/Complex/IR/ComplexOps.cpp.inc"
-
-OpFoldResult ReOp::fold(ArrayRef<Attribute> operands) {
-  ArrayAttr arrayAttr = operands[0].dyn_cast<ArrayAttr>();
-  return arrayAttr[0];
-}
-
-OpFoldResult ImOp::fold(ArrayRef<Attribute> operands) {
-  ArrayAttr arrayAttr = operands[0].dyn_cast<ArrayAttr>();
-  return arrayAttr[1];
-}

diff  --git a/mlir/test/Dialect/Complex/canonicalize.mlir b/mlir/test/Dialect/Complex/canonicalize.mlir
deleted file mode 100644
index 3ad66f908f538..0000000000000
--- a/mlir/test/Dialect/Complex/canonicalize.mlir
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: mlir-opt %s -canonicalize | FileCheck %s
-
-// CHECK-LABEL: func @real_of_const(
-func @real_of_const() -> f32 {
-  // CHECK: %[[CST:.*]] = constant 1.000000e+00 : f32
-  // CHECK-NEXT: return %[[CST]] : f32
-  %complex = constant [1.0 : f32, 0.0 : f32] : complex<f32>
-  %1 = complex.re %complex : complex<f32>
-  return %1 : f32
-}
-
-// CHECK-LABEL: func @imag_of_const(
-func @imag_of_const() -> f32 {
-  // CHECK: %[[CST:.*]] = constant 0.000000e+00 : f32
-  // CHECK-NEXT: return %[[CST]] : f32
-  %complex = constant [1.0 : f32, 0.0 : f32] : complex<f32>
-  %1 = complex.im %complex : complex<f32>
-  return %1 : f32
-}


        


More information about the Mlir-commits mailing list