[flang-commits] [flang] e8b7012 - [flang] Remove unused AffineMapAttr from fir.box type

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Fri Sep 30 11:36:07 PDT 2022


Author: Valentin Clement
Date: 2022-09-30T20:35:55+02:00
New Revision: e8b701208c792689e585370978a0ea747ba6342b

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

LOG: [flang] Remove unused AffineMapAttr from fir.box type

AffineMapAttr on fir.box type is not used. This patch
remove it. It can be added back later when needed.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D134955

Added: 
    

Modified: 
    flang/include/flang/Optimizer/Dialect/FIRTypes.td
    flang/lib/Optimizer/Dialect/FIRType.cpp
    flang/test/Fir/invalid-types.fir

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/Dialect/FIRTypes.td b/flang/include/flang/Optimizer/Dialect/FIRTypes.td
index 1627d334e074a..de310a9972ac3 100644
--- a/flang/include/flang/Optimizer/Dialect/FIRTypes.td
+++ b/flang/include/flang/Optimizer/Dialect/FIRTypes.td
@@ -75,25 +75,24 @@ def fir_BoxType : FIR_Type<"Box", "box"> {
     to) whether the entity is an array, its size, or what type it has.
   }];
 
-  let parameters = (ins "mlir::Type":$eleTy, "mlir::AffineMapAttr":$map);
+  let parameters = (ins "mlir::Type":$eleTy);
 
   let skipDefaultBuilders = 1;
 
   let builders = [
     TypeBuilderWithInferredContext<(ins
-        "mlir::Type":$eleTy,
-        CArg<"mlir::AffineMapAttr", "{}">:$map), [{
-      return Base::get(eleTy.getContext(), eleTy, map);
+        "mlir::Type":$eleTy), [{
+      return Base::get(eleTy.getContext(), eleTy);
     }]>,
   ];
 
   let extraClassDeclaration = [{
     mlir::Type getElementType() const { return getEleTy(); }
-    mlir::AffineMapAttr getLayoutMap() const { return getMap(); }
   }];
 
   let genVerifyDecl = 1;
-  let hasCustomAssemblyFormat = 1;
+
+  let assemblyFormat = "`<` $eleTy `>`";
 }
 
 def fir_CharacterType : FIR_Type<"Character", "char"> {

diff  --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index 8963fec2f8f65..2fb542582bccb 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -377,35 +377,9 @@ static bool cannotBePointerOrHeapElementType(mlir::Type eleTy) {
 // BoxType
 //===----------------------------------------------------------------------===//
 
-// `box` `<` type (',' affine-map)? `>`
-mlir::Type fir::BoxType::parse(mlir::AsmParser &parser) {
-  mlir::Type ofTy;
-  if (parser.parseLess() || parser.parseType(ofTy))
-    return {};
-
-  mlir::AffineMapAttr map;
-  if (!parser.parseOptionalComma()) {
-    if (parser.parseAttribute(map)) {
-      parser.emitError(parser.getCurrentLocation(), "expected affine map");
-      return {};
-    }
-  }
-  if (parser.parseGreater())
-    return {};
-  return get(ofTy, map);
-}
-
-void fir::BoxType::print(mlir::AsmPrinter &printer) const {
-  printer << "<" << getEleTy();
-  if (auto map = getLayoutMap()) {
-    printer << ", " << map;
-  }
-  printer << '>';
-}
-
 mlir::LogicalResult
 fir::BoxType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
-                     mlir::Type eleTy, mlir::AffineMapAttr map) {
+                     mlir::Type eleTy) {
   // TODO
   return mlir::success();
 }

diff  --git a/flang/test/Fir/invalid-types.fir b/flang/test/Fir/invalid-types.fir
index ae4aa627d7e3e..afd23b6954bea 100644
--- a/flang/test/Fir/invalid-types.fir
+++ b/flang/test/Fir/invalid-types.fir
@@ -6,13 +6,8 @@ func.func private @box3() -> !fir.boxproc<>
 
 // -----
 
-// expected-error at +2 {{expected attribute value}}
-// expected-error at +1 {{expected affine map}}
-func.func private @box1() -> !fir.box<!fir.array<?xf32>, >
-
-// -----
-
-// expected-error at +1 {{expected non-function type}}
+// expected-error at +2 {{expected non-function type}}
+// expected-error at +1 {{failed to parse fir_BoxType parameter 'eleTy' which is to be a `mlir::Type`}}
 func.func private @box1() -> !fir.box<>
 
 // -----


        


More information about the flang-commits mailing list